EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #10316
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
RE: [EP-tech] Display different DOM elements depending if user logged in
- To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
- Subject: RE: [EP-tech] Display different DOM elements depending if user logged in
- From: John Salter <J.Salter@leeds.ac.uk>
- Date: Wed, 14 Jan 2026 08:38:03 +0000
|
CAUTION: This e-mail originated outside the University of Southampton.
Hi Allen, Yes, it is possible
😊 There are three different parts below (user-area template; pins; plugin settings). You may need more than one of them. Hopefully I’ve put the most useful/likely one first. After making any of these changes, run ~/bin/epadmin test ARCHIVEID and (assuming there’s no errors) then restart Apache. ------------- To use a specific user-area template: For EPrints 3.3.x:
$c->{user_area_template} = 'user'; in a config file e.g. ~/archives/ARCHIVEID/cfg/cfg.d/user_template.pl
For EPrints 3.4.x, there is a ‘default_internal’ template that can be edited. ------------- There may be aspects that you want to control based on aspects of the logged-in user e.g. displaying additional things to an editorial user. You can use a custom pin for this -
https://wiki.eprints.org/w/Branding_with_confidence#Adding_dynamic_content The function could look something like this (look in ~/archives/ARCHIVEID/cfg/cfg.d/ for files that contain ‘dynamic_template’ – if this exists, add to it!): $c->{dynamic_template}->{function} = sub { my( $repository, $parts ) = @_; my $user = $repository->current_user; if( !defined $user ) { $parts->{new_pin_name} = $repository->make_doc_fragment; # empty fragment } elsif( $user->is_staff ) { $parts->{new_pin_name} = $repository->html_phrase( "new_pin_name_phrase:staff", #something specific to editors/admins ); } else { $parts->{new_pin_name} = $repository->html_phrase( "new_pin_name_phrase:user", ); } }; ------------- To control where links to EPrint screen plugins appear, you can also set this in the archive config. See notes in ~/archives/ARCHIVEID/cfg/cfg.d/plugins.pl e.g. to exclude the ‘Register’ link from the default toolbar, set the ‘appears’ to undef. $c->{plugins}->{"Screen::Register"}->{actions}->{register}->{appears}->{key_tools} = undef; ------------- If you need any additional info/assistance with the above, let me know. Cheers, John John Salter https://orcid.org/0000-0002-8611-8266 White Rose Libraries Technical Officer From: eprints-tech-request@ecs.soton.ac.uk <eprints-tech-request@ecs.soton.ac.uk>
On Behalf Of Allen Tullett
CAUTION: This
e-mail originated outside the University of Southampton. CAUTION: This
e-mail originated outside the University of Southampton. Hello, I'm currently rebuilding my institutions theme and am seeking the capability to restrict the visibility of menu items and more to if a user if logged in to the site or not. Has anyone done this before and is it possible? I cannot find any guidance on this and wondered if anyone may be able to share their solution. I suspect it has something to do with a pin but for all my efforts to date I have had no luck. Appreciate any help you can provide. Best, Allen Allen Tullett "That's how it's going to work out, give it a go" |
- References:
- [EP-tech] Hi and help
- From: "kralizeck@gmail.com" <kralizeck@gmail.com>
- Re: [EP-tech] Hi and help
- From: David R Newman <drn@ecs.soton.ac.uk>
- Re: [EP-tech] Hi and help
- From: "kralizeck@gmail.com" <kralizeck@gmail.com>
- [EP-tech] Display different DOM elements depending if user logged in
- From: Allen Tullett <A.Tullett@kent.ac.uk>
- [EP-tech] Hi and help
- Prev by Date: [EP-tech] Display different DOM elements depending if user logged in
- Next by Date: Re: [EP-tech] core recommender
- Previous by thread: [EP-tech] Display different DOM elements depending if user logged in
- Next by thread: [EP-tech] report on how many users with ORCIDs in our repository, but limited by year/date.
- Index(es):
