MyBB Community Forums

Full Version: Check if user is logged
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I check if a user is logged?
I'd like to show a button in the header only to members and I don't want to modify the header_welcomeblock_member.

Thank you
  • header_welcomeblock_member
(2015-07-17, 10:36 AM)Zlatan Wrote: [ -> ]How can I check if a user is logged?
You could search him/her in the memberlist
(2015-07-17, 10:36 AM)Zlatan Wrote: [ -> ]I'd like to show a button in the header only to members and I don't want to modify the header_welcomeblock_member.
Don't you see the contradiction in this? Which template do you have in mind when header_welcomeblock_member is not an option?
And further, where must this button bring you to?
(2015-07-17, 10:55 AM)Ad Bakker Wrote: [ -> ]
(2015-07-17, 10:36 AM)Zlatan Wrote: [ -> ]How can I check if a user is logged?
You could search him/her in the memberlist
(2015-07-17, 10:36 AM)Zlatan Wrote: [ -> ]I'd like to show a button in the header only to members and I don't want to modify the header_welcomeblock_member.
Don't you see the contradiction in this? Which template do you have in mind when header_welcomeblock_member is not an option?
And further, where must this button bring you to?

I want members to have a link that when is clicked redirect them to an external page,
can I do something like this in the header template?
<?php if ($mybb->user['uid']) ?>
                            <li ><a href="{$mybb->settings['bburl']}/externalpage.html" target="_blank"> External Page {$lang->toplinks_externalpage}</a ></li >
^ you can use php in templates plugin to use such php based condition in the header template
however it would be better to use template conditionals plugin (instead of php in templates) & add a simple condition

required codes guidance is available at the plugins release threads there