miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Different Header for Guests and Members

 
Author ypsie
Partaker
#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 
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
Partaker
#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
Partaker
#5 | Posted: 17 Jan 2005 12:10 
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
Partaker
#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
Partaker
#9 | Posted: 17 Jan 2005 12:27 
$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
Partaker
#11 | Posted: 17 Jan 2005 12:37 
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
 Share Topic's Link

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


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Proceed with the Private Messaging add-on: allow your miniBB-forums members to communicate with each other.


  ⇑