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


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:

  1. Copy the ‘default.xml’ template to ‘user.xml’
  2. Set

$c->{user_area_template} = 'user';

in a config file e.g. ~/archives/ARCHIVEID/cfg/cfg.d/user_template.pl

  1. Edit the user.xml template to suit requirements (possibly adding

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
Library and Research Management team, IT
University of Leeds

 

 

 

From: eprints-tech-request@ecs.soton.ac.uk <eprints-tech-request@ecs.soton.ac.uk> On Behalf Of Allen Tullett
Sent: 13 January 2026 15:47
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Display different DOM elements depending if user logged in

 

CAUTION: External Message. Use caution opening links and attachments.

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
Systems Operations Engineer | System Integrations and Operations | Information Technology Services | University of Kent
Cornwallis South, G43

 

"That's how it's going to work out, give it a go"