Community & Support

Theme override to not display submitted info to anonymous

I am new to php coding and syntax. I have searched the forums and tried many things but I am not having success.

I would like to be able to override the theme display so that the submitted information is not shown to anonymous users but is visible to authenticated users.

I am using Drupal 6.x updated to the latest version and have copied the garland theme to garlandcustom in the site specific directory, and have made changes to the .info file so it is working.

The content types involved include stories, forum posts and blog posts.

I have tried various changes in the node.tpl.php file but they are not working.

I would appreciate any help to get this working. Thanks,

Izzy

Comments

One way is like this: global

One way is like this:

global $user;
if (0 != $user->uid) {
  // Here put things for non-anonymous users
}

meaning if the user ID is not zero (which means the user is authenticated) then do something. This:

global $user;
if (0 != $user->uid) {
    print '<span class="submitted">' . $submitted . '</span>';
}

may be what you are after.

--
CiviHosting - Drupal Hosting Specialists -- 100% Satisfaction Guaranteed

Thanks for the suggestion. I

Thanks for the suggestion.

I tried placing this in node.tpl.php but it does not work. Maybe, because the content includes forum topics and blogs? I'm just guessing that there is something more needed for those content types.

Izzy

It is now working. Thank

It is now working. Thank you. I kept on persisting and found my difficulties were related to new tpl files resulting from the use of OG. I copied those to the theme directory and made the changes in there. That was the missing piece. I was almost there before.

Thanks for taking the time to respond and lend a hand.

Izzy

nobody click here