MyBB Community Forums

Full Version: hide header from not logged in persons
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I am running version 1.2.13. I have enabled that users must log in, to see/do anything.
I've added some external links in the header (where you can find calendar, member list and so on).

Unfortunately users, not logged in, can see the header (at the place they are supposed to log in) and access the external links.
I'd like to disable that!

In short: is there a way to show the header only to logged in users?

Best regards


Sorry, if this has been asked before, but I didn't find anything matching with the search.
Hi,

You will need to do some changes to the file called global.php in order for this to work.

First, login to your ftp account and navigate to the forum root directory and locate the file called global.php, download that to your computer and open it in a text editor (such as NotePad++).

Next, locate the following code:
// Tell the user their PM usage
	$lang->welcome_pms_usage = sprintf($lang->welcome_pms_usage, my_number_format($mybb->user['pms_new']), my_number_format($mybb->user['pms_unread']), my_number_format($mybb->user['pms_total']));
eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_member")."\";");

Under
eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_member")."\";");

Add:
eval("\$members_only = \"".$templates->get("members_only")."\";");

Now, save that file and reupload it, replacing the old global.php on the server.

Then, login to the Admin CP, go to > Templates > Modify/Delete > *Your Templates Name* > Expand > Click on the "header" template > Where you had the code that you want only members to view, replace it with:
{$members_only}

Then click "Add Template"

Finally, back at the templates home screen, click "Add Template", calling the title "members_only', place what you want members to see in the "Template" textarea and then click "Add Template".

The links you have added should now only show to members,
Chris.
Wow! This works perfectly!
Every day I love this boardsoftware and the community more and more =)

Thank you so much.


Best regards
Simon
Chris W B......

Brilliant tutorial mate.
Thanks heaps!

Owen
wonderful stuff.. very useful!