Created
July 23, 2019 13:02
-
-
Save jesusbagpuss/b96dd5520018f2ec51c4c76d40e1d9b0 to your computer and use it in GitHub Desktop.
EPrints User preference for Screen::Items/eprint_status (file to be saved in EPRINTS_ROOT/bin/local/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# Usage: ~/bin/local/get_user_preferences ARCHIVEID USERID | |
# NOTE: If you save this to a location other that EPRINTS_ROOT/bin/local/ the 'use lib' statement | |
# below will need to be adjusted accordingly | |
use FindBin; | |
use lib "$FindBin::Bin/../../perl_lib"; | |
use EPrints; | |
use strict; | |
use Data::Dumper; | |
$|=1; | |
my $noise = 1; | |
my $repoid = $ARGV[0]; | |
my $userid = $ARGV[1]; | |
my $doit = $ARGV[2]; | |
my $session = new EPrints::Session( 1 , $repoid , $noise ); | |
if( !defined $session ) | |
{ | |
print STDERR "Failed to load repository: $repoid\n"; | |
exit 1; | |
} | |
if( !defined $userid ) | |
{ | |
print STDERR "Please supply a userid\n"; | |
exit 1; | |
} | |
my $user = EPrints::DataObj::User->new( $session, $userid ); | |
if( !defined $user ) | |
{ | |
$session->get_repository->log( "User #$userid not found\n" ); | |
exit 1; | |
} | |
print $user->get_value( "username" ), " (", $user->get_value( "email" ), ")\n"; | |
my $val = $user->preference( 'Screen::Items/eprint_status' ); | |
print "Existing user preference for 'Screen::Items/eprint_status':\n"; | |
print Dumper( $val ); | |
$session->terminate(); | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment