So I'm trying to port a site (www.dialognow.org) from scoop to drupal. In the original site there's a button in the header that displays as a "post a story" link if the user is logged in and has permissions, and as a "join dialognow" button otherwise.
How can I duplicate this functionality in drupal? Within my theme code can I access the $user object? I've tried putting code like the following in my header function
if($user->uid){
//print new story button
}
but it doesn't work (always goes to else clause, even if the user is logged in).
As a test, I put in the following:
echo($user->name);
echo($user->role);
echo($user->uid);
but nothing prints out. By the way, I am no php expert, so if this is a dumb question I apologise. Anyone have any suggestions about how to do this?
Comments
do a
global $user;before checking for uid etc.that worked!
thanks ax. U da man.