Version: 1.00, by KuraFire
Developer Last Online: Nov 2023
Version: 2.2.x
Rating:
Released: 05-07-2002
Last Update: Never
Installs: 75
No support by the author.
Oh my Kura, you're releasing small, simple hacks every day now, huh? What's this one about?
Rest assured, after this one I don't have anything to release for a while (only stuff that has no purpose outside my own board).
Well, this hack. What it does is 'merge' the Register and User CP buttons. If a viewer is a guest or just not logged in, the link will display a Register button (or text link, whatever you want). If the viewer IS logged in, and therefore a member, it will display the User CP button instead.
Add ABOVE that, the following code:
Make sure to remove the space between {imagesfolder and }!!
PHP Code:
// guest/member register/usercp hack
if($bbuserinfo['userid'] != 0) {
$reg_ucp = "<a href=\"usercp.php?s=$session[sessionhash]\">".
"<img src=\"{imagesfolder }/usercp.gif\" ".
"alt=\"Here you can view your subscribed threads, work with private messages and edit your profile and preferences\" ".
"border=\"0\"></a>";
}else{
$reg_ucp = "<a href=\"register.php?s=$session[sessionhash]&action=signup\">".
"<img src=\"{imagesfolder }/register.gif\" ".
"alt=\"Registration is free!\" border=\"0\"></a>";
}
Step 2: save your global.php and go to Edit your Header template (Styles > modify > fonts/colors > Header). Now, put
$reg_ucp
somewhere in your Header, where you want the UserCP / Register button to appear. Make sure to remove the 'hardcoded' buttons that are already in there, of course.
Save, and you're done.
Note that if you aren't using the default vB templates and graphics (which is 99% likely? ) you'll have to adjust the code above to suit your needs. If you don't use images, just remove the image part there and replace it with text links.
Extra feature that you can use with this hack: add Guest-only banners or something alike. In other words, only guests will see the banner (which could say something like "Want to get rid of this annoying banner? Then sign up now!") and users who are logged in won't see anything.
To do so, use something like this:
PHP Code:
// guest/member register/usercp hack
if($bbuserinfo['userid'] != 0) {
$reg_ucp = "blablabla usercp";
$banner = "";
}else{
$reg_ucp = "blablabla register";
$banner = "<img src=\"{imagesfolder }/banner.gif\" />".
"<br />Want to get rid of this banner? Then sign up now!";
}
Now place $banner in your header or footer wherever you want, and only guests will see it.
Enjoy!
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.