[EP-tech] Re: views_render to manipulate a views index

Stephen Shorrock sms67 at cam.ac.uk
Wed Jun 27 16:59:38 BST 2012

On 27/06/2012 14:02, Florian Heß wrote:
> Am 27.06.2012 12:34, schrieb Stephen Shorrock:
>> Dear list,
>> I've created a view on the authors_id|editors_id but when displaying I
>> would like to replace the ids (username) of the users with their
>> associated account names as stored in the users table.  These account
>> names have to be looked up as they are not saved as part of the
>> publication (when the publication is rendered the UNDEFINED is hidden),
>> as the user does exist in the publication but may have a slightly
>> different name as published by the journal and these names are saved
>> without usernames.
>> My question is:  Is there a way via the configuration options of EPrints
>> to implement such a lookup & replacement (creators_id / username =>
>> account name) for the purpose of views, I was looking at some of the
>> views_render examples as provided with the application could the
>> replacement be done via one of these.  There is no documentation about
>> views_render on the EPrints website.
> Hi Stephen,
> The as_item function should do, but I do not know the composite field
> name of name_family, name_given etc. if it exists:
> $item{userid}.as_item(){wanted_field}
> Another option is $item{userid}.as_item().citation('brief'), but it will
> print also the email address as is default.
> Regards,
> F Heß
Thanks Florian,

I think what I need to do is produce a views_render_menu_to_names.pl 
subroutine that I can call via render_menu=> in the view definition.

Something inside copy of (views_render_menu_example.pl) like:

$a2 = $session->render_link($link);


$user = $session->get_repository()->user_by_username($value);
if (defined($user)){
     $a2->appendChild(($user->render)[1]); # $user->render returns 
($page,$title) - though haven't looked at what $page is

does the trick


More information about the Eprints-tech mailing list