Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
Doulos
Life Cycles Becoming CPU Cycles



Joined: Jun 06, 2005
Posts: 732

PostPosted: Sat Dec 15, 2018 10:36 pm Reply with quote

I want to put a link to site admin in the menu nukeNAV but I would like it to be only visible by a particular user. Nothing I have tried has worked. Any ideas?
I have tried:
Code:
if ($_SESSION['user_id'] == useridnumber) {

   $content .= '<li><a href="https://mysite.com/admin.php">'._SITEADMIN."</a>\n";
}


Link shows up in menu fine unless I try to restrict it to a particular user.
 
View user's profile Send private message
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1772

PostPosted: Sun Dec 16, 2018 3:05 am Reply with quote

You don't need the session GLOBAL:

php Code:
global $user;

if (is_user($user)) {
$userinfo = getusrinfo($user);
$user_id = $userinfo['user_id'];
$username = $userinfo['username'];
/*
place your specific user code here
*/
if ($username == 'Doulos' || $user_id == 123456) {
$content .= '<li><a href="https://mysite.com/admin.php">' . _SITEADMIN . '</a>' . PHP_EOL;
}
} else {
$userinfo = array();
}


Wink

_________________
Github: RavenNuke 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©