PDA

View Full Version : User Logout


sonik44
12-16-2005, 08:25 AM
I made a top menu for my site in the old main_top.php file and it showed a "logout" link only if a user was logged in. I made the same top menu in the new main_body.tpl file but now the logout link is always on regardless if a user is logged in or not. Here is the code I was using...

Content visible to registered users only.

Any suggestions on how to show this link to logged in users only?

Thanks...

natio :: phpFox
12-16-2005, 04:33 PM
ah yeah, with the new .tpl system PHP cant be added to the html template files.
So if you want to add the logout link you can do it like this:

Content visible to registered users only.

that should then hide it when a user is logged in.

so with the new layout you will find in the html files areas like
Content visible to registered users only.

which is used to hide certain ares when a member is logged in or not. :)

sonik44
12-16-2005, 07:11 PM
Perfect....works great.

Thanks

sonik44
12-16-2005, 11:31 PM
Ok so now I've been trying for hours to make the same type of link on the top of profile_template.php and I cant get it to work. I was hoping for the menu to show up differently for logged in users and non logged in users.

If logged in show:

MEMBERS HOME | BROWSE | MUSIC | FORUM | GAMES | PHOTOS | CLASSIFIEDS | GROUPS | LOGOUT [USERNAME]

If not logged in show:

BECOME A MEMBER | BROWSE | MUSIC | FORUM | GAMES | PHOTOS | CLASSIFIEDS | GROUPS | LOGIN

Heres what I have so far...
Content visible to registered users only.

It worked on my old main_top.php but I can't get it to work now. I've tried many different combinations. Any help would be appreciated...Thanks

natio :: phpFox
12-17-2005, 03:41 AM
oh i see what what wrong here, you might have added in the PHP code inside the actual ECHO tag.

so if you want to add that routine to the "profile_template.php" you will have to do something like this: ( note this is just a example )

Content visible to registered users only.

So in the above code you can point out first the php routine:
Content visible to registered users only.

then i added in your html in the ECHO area:
Content visible to registered users only.

Give that a try and get back to me if this helped.

sonik44
12-17-2005, 08:02 AM
WOW.... It finally works! I've been working on this for hours. I had to make a few slight changes but I finally got it working the way I want. I really appreciate the help. I'm still a just a novice when it comes to PHP. Your explanation was perfect. Thank you very much Mike. Works like a charm....

natio :: phpFox
12-18-2005, 12:35 AM
:D . Awesome. Im glad it helped out. Yeah there is so much to learn in PHP, i feel like im always a novice myself when it comes to PHP cause of things you can learn everyday. :D