Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Register link for guests, User CP link (or button) for members. Details »»
Register link for guests, User CP link (or button) for members.
Version: 1.00, by KuraFire KuraFire is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

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.

Click here for an example
(where `register` is will be `user cp` when you're logged in).

I mean, why have a Register button for members available, and a User CP button available for guests?

Exactly, that makes no sense, therefore, this hack.


Instructions

Step 1: Open your global.php and find this line:

PHP Code:
// ###################### Start templates ####################### 
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.

Comments
  #12  
Old 05-08-2002, 10:23 PM
Dark Odin Dark Odin is offline
 
Join Date: Jan 2002
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First attempt at posting anything.
Reply With Quote
  #13  
Old 05-08-2002, 10:43 PM
scsa20's Avatar
scsa20 scsa20 is offline
 
Join Date: Mar 2002
Location: Mars
Posts: 458
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did mine an easyer way (find this out by looking around the template mod. forum ) and here's how I did mine (2 different ways)....for the buttons (I used this on 2 template sets), I just added the following to the "phpinclude" template:

PHP Code:
if ($bbuserinfo['userid']<"1") {
    
$regcp "<a href=\"register.php?s=$session[sessionhash]&action=signup\"><img src=\"{imagesfolder }/top_register.gif\" alt=\"Registration is free!\" border=\"0\"></a>";
} else {
    
$regcp "<a href=\"usercp.php?s=$session[sessionhash]\"><img src=\"{imagesfolder }/top_profile.gif\" alt=\"Here you can view your subscribed threads, work with private messages and edit your profile and preferences\" border=\"0\"></a>";
        
$vlogout "<a href=\"member.php?s=$session[sessionhash]&&action=logout\"><img src=\"{imagesfolder }/top_logout.gif\" alt=\"Log Out\" border=\"0\"></a>";
}
if (
$bbuserinfo['usergroupid']==6) {
    
$vadminbutton "<a href=\"/admin/index.php?s=$session[sessionhash]\" target=\"_blank\"><img src=\"{imagesfolder }/top_admin.gif\" alt=\"Go to your Admin Panel\" border=\"0\"></a>";
}

if (
$bbuserinfo['usergroupid']==7) {
    
$vmodbutton "<a href=\"/mod/index.php?s=$session[sessionhash]\" target=\"_blank\"><img src=\"{imagesfolder }/top_mod.gif\" alt=\"Go to your Mod Panel\" border=\"0\"></a>";

and then just replace <!-- toplinks --> down to <!-- /toplinks --> with:

Code:
   <!-- toplinks -->
  $vadminbutton
  $vmodbutton
  $regcp
  <a href="calendar.php?s=$session[sessionhash]"><img src="{imagesfolder }/top_calendar.gif" alt="Calendar" border="0"></a>
  <a href="memberlist.php?s=$session[sessionhash]"><img src="{imagesfolder }/top_members.gif" alt="Find other members" border="0"></a>
  <a href="misc.php?s=$session[sessionhash]&action=faq"><img src="{imagesfolder }/top_faq.gif" alt="Frequently Asked Questions" border="0"></a>
  <a href="search.php?s=$session[sessionhash]"><img src="{imagesfolder }/top_search.gif" alt="Search" border="0"></a>
  <a href="index.php?s=$session[sessionhash]"><img src="{imagesfolder }/top_home.gif" alt="Home" border="0"></a>
  $vlogout
   &nbsp;
   <!-- /toplinks -->
(make sure you remove the spaces between from {imagesfolder and })

or you can put this in the "phpinclude" template:

PHP Code:
//Administrative/Moderator Login
if ($bbuserinfo[usergroupid]==6) { //Admins
$adminlogin "<a href=\"admin/index.php\">Administrative Login</a><br>";
} elseif ((
$bbuserinfo[usergroupid]==5) or ($bbuserinfo[usergroupid]==7)) { //Mods
$adminlogin "<a href=\"mod/index.php\">Moderator Login</a><br>";
} else { 
//Everyone else
$adminlogin "";
}
//End Login Code 
then just add $adminlogin anywhere in the footer template..and remember, you can always play around with the code
Reply With Quote
  #14  
Old 05-08-2002, 11:00 PM
Takara's Avatar
Takara Takara is offline
 
Join Date: Apr 2002
Location: :bunny:
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by KuraFire
Takara, actually, my hack said { imagesfolder } but if I type it without the spaces, it gets parsed... o_O

But it all looks commented out fine on _my_ screen, nonetheless.... o.o
Oooohhhhh, lol. I uploaded what mine looked like.

Anyway ^-^
Reply With Quote
  #15  
Old 05-08-2002, 11:03 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

scsa20: sure, that works too, but it's totally not necessary on my board (how the hell you found that "an easier way" is beyond me, though. ).
I have my Admin Panel on my Personal Bookmark Folder, so I just have to click on one link to get there, no matter _what_ site or page I'm browsing (so I can be on this forum and still jump there with 1 click). As for the Mod panel, they don't have anything to do there on my board except ban users, and that's something they don't often have to do at all, and usually I'm the one doing it anyhow.

But, thanks for the addition anyway, some other people might well appreciate it. :up:
Reply With Quote
  #16  
Old 05-08-2002, 11:06 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Takara, as a suggestion: export images as .GIF if they don't use a lot of colors (ie. forum screenshots, for instance) - top quality and very small filesizes. Much better than these horrid, horrid .jpg's
Reply With Quote
  #17  
Old 05-10-2002, 02:50 PM
Birdie501's Avatar
Birdie501 Birdie501 is offline
 
Join Date: Dec 2001
Location: Germany
Posts: 272
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

does somebody know how i can put these function in a javascript coded menu?

I use the xmenu hack
https://vborg.vbsupport.ru/showthrea...ighlight=xmenu

and want to use this function?

Thanks alot!
Reply With Quote
  #18  
Old 05-14-2002, 10:03 AM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't help you with that, if you still _need_ help, even.... :/
Reply With Quote
  #19  
Old 05-21-2002, 11:27 AM
Birdie501's Avatar
Birdie501 Birdie501 is offline
 
Join Date: Dec 2001
Location: Germany
Posts: 272
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks, i found another solution, thanks!
Reply With Quote
  #20  
Old 05-21-2002, 10:03 PM
FleaBag's Avatar
FleaBag FleaBag is offline
 
Join Date: Dec 2001
Posts: 1,674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well for starters I'm using version 2.2.5, and nowhere in my global.php do I see the above mentioned reference. I tried putting this...

PHP Code:
if ($bbuserinfo['userid'] != 0) {
          eval(
"\$reglinks = \"".gettemplate("reglinks_on")."\";");
        }else{
eval(
"\$reglinks = \"".gettemplate("reglinks_off")."\";");

...in my phpinclude template, created the templates reglinks_on and reglinks_off, and put $reglinks in my HTML - but nothing happens. Anyone have any ideas?
Reply With Quote
  #21  
Old 05-22-2002, 06:45 AM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Your root/global.php should have these two lines, somewhere around line 270-280:

PHP Code:
// ###################### Start templates #######################
//prepare default templates ********************** 
If they aren't in it, you're using some weird unoffical version of vB, OR a different language version.

If you can't find that, try finding this:

PHP Code:
if ($bbuserinfo['userid']==and $usereferrer and !$bbreferrerid and $referrerid) {
  if (
$r_id $DB_site->query_first("SELECT userid FROM user WHERE userid = '".addslashes($referrerid)."'")) {
    
vbsetcookie("bbreferrerid",$r_id[userid]);
  }

And add this below it:

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>";


It won't work through templates, since you'd have to have a global-in-global template, which doesn't exist in vB.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:57 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04881 seconds
  • Memory Usage 2,356KB
  • Queries Executed 27 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (9)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete