miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /   

Different Header for Guests and Members

Author ypsie
Registered
#1 | Posted: 17 Jan 2005 09:14 
Hi,

I did not want, that the active link was never showed in the header navigation. So I had to edit the code and replace it with a non dynamic one.

But I want, that I can use seperated links for non-members and members. For example: "Preferences" for members, but "Introduction" for non-members.

How to deal with? How can I include different header templates?

Bye, Julian

Author Team
8-)
#2 | Posted: 17 Jan 2005 10:11 | Edited by: Admin 
Header templates, in general, don't matter here. You need to edit load_header() function inside bb_function.php and handle header variables corresponding to user ID ($user_id). For logged users, user ID is not equal to 0, and vice versa.

Author ypsie
Registered
#3 | Posted: 17 Jan 2005 11:52 
Thanks for the fast answer. But what do I have to change, if I want, that the active link is also shown in the header navi??

Bye, Julian

Author Team
8-)
#4 | Posted: 17 Jan 2005 12:06 
Begin from the following: are you familiar with PHP?

Author ypsie
Registered
#5 | Posted: 17 Jan 2005 12:10 | Edited by: ypsie 
Unfortunately not really, but I tried this:

//--------------->
function load_header() {
//we need to load this template separately, because we load page title
if(strlen($GLOBALS['user_id'])>0) echo 'logged out links';
else echo "logged in links";

if (!isset($GLOBALS['title']) or $GLOBALS['title']=='') $GLOBALS['title']=$GLOBALS['sitename'];
if(isset($GLOBALS['includeHeader'])) { include($GLOBALS['includeHeader']); return; }
return ParseTpl(makeUp('main_header'));
}

//--------------->

It does not work... the echo "" I will replace with the links, but what is wrong?



//--------------->
function load_header() {
//we need to load this template separately, because we load page title
if(($GLOBALS['user_id'])>0) echo 'ewfewfwe';
else echo "naja";

if (!isset($GLOBALS['title']) or $GLOBALS['title']=='') $GLOBALS['title']=$GLOBALS['sitename'];
if(isset($GLOBALS['includeHeader'])) { include($GLOBALS['includeHeader']); return; }
return ParseTpl(makeUp('main_header'));
}

//--------------->

Oh my god :) Its working. Thats nice!
Thank you... *g*

Author Team
8-)
#6 | Posted: 17 Jan 2005 12:14 
if($GLOBALS['user_id']==0) echo 'logged out links';
else echo "logged in links";

Author ypsie
Registered
#7 | Posted: 17 Jan 2005 12:18 
But what do I have to do now?
Instead of "echo" I use an include - thats clear.

But how can I define a variable like "{$l_menu[3]}" in main_header.
What do I have to change in the bb_functions?

Thanks! Julian

Author Team
8-)
#8 | Posted: 17 Jan 2005 12:26 
Actually, "Registration" and "Preferences" links are already separated by logged in and not logged in users. So, you can simply change this:

if($GLOBALS['action']!='registernew' and $GLOBALS['user_id']==0 and $GLOBALS['adminPanel']!=1 and $GLOBALS['enableNewRegistrations']) $GLOBALS['l_menu'][2]="{$GLOBALS['l_sepr']} <a href=\"{$GLOBALS['main_url']}/{$GLOBALS['indexphp']}action=registernew \">{$GLOBALS['l_menu'][2]}</a> "; else $GLOBALS['l_menu'][2]='';

and put the link you want users visit when registering, instead of action=registernew.

As about another procedures - just check how load_header() parses these variables... you can define new there or in language pack.

Author ypsie
Registered
#9 | Posted: 17 Jan 2005 12:27 | Edited by: ypsie 
$navi="if($GLOBALS['user_id']==0) echo 'logged out links';
else echo "logged in links";"

This way would be much easier for me...

Is that possible? If yes, how can I include $navi in main_header?

Bye, Julian

Author Team
8-)
#10 | Posted: 17 Jan 2005 12:34 
$GLOBALS['navi']=($GLOBALS['user_id']==0?'logged out links':'logged in links');

and simply put {$navi} in the template...

Author ypsie
Registered
#11 | Posted: 17 Jan 2005 12:37 | Edited by: ypsie 
Thank you very much!
It seems to be working - wonderful!

A dream comes true ;)

Bye, Julian

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications / Different Header for Guests and Members Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB