MyBB Community Forums

Full Version: If guest show register link - help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm currently making a theme and whilst editing the header file I'm wondering if it's possible to make a link i.e register that will only show if a guest is online.

I know this is achieved inside of the welcome block but I am trying to add this elsewhere on the page in my own styling.

Is it an OOP mybb class thing?

thanks.
Open your global.php

Find
// Run global_start plugin hook now that the basics are set up
$plugins->run_hooks("global_start");

Add Below
if($mybb->user['uid'] == 0)
{
    $reglink = "<a href=\"member.php?action=register\">Register</a>";
}

Assign your class/style to $reglink and use {$reglink} where you want to display it.
thanks however if this is a theme shouldn't it be editable only in the template/xml file?
Well, you could either edit each theme, or add it globally like LeX- showed you.
Are you sure? Well I can't do it globally becuase it required the user to edit none theme files so how would you it in each theme as you said?

Thanks.
thanks for this.. i added an "else" code to show the link for members.. Toungue