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
  #42  
Old 06-14-2002, 10:41 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry, I just hate when people quote massive posts and then not respond to the actual post contents directly, thus making their own posts unnecessarily huge. It annoys me to no end, it's so inefficient and impractical!

I tend to be very efficient and practical in life, and with some things I definitely even succeed in that - it just gets on my nerves when other people just walz over it without giving it a moment's thought...

take no offense, I'm just muttering madly here
Reply With Quote
  #43  
Old 06-14-2002, 10:51 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We are of the same mind, it seems. I, too, like order and discipline in my life (although you would never know it as bad as my board looks right now ). But, alas, I just found out I'm going to be a father again...twice! (Twins) That is why the board has taken a back seat the last few days. That is also why I am trying to get things in order so I can get it finished. Which brings me to what I was looking to do with the scroller.

Is there a way to set that code up for the banner to call a template that would have the javascript code in it for the scroller? Or can I even do it that way? What I would like to do is have it put the scroller up for guests but not for the regsitered users, only I will have to make a table for it for the guests and remove the table for the regular users. If any of that doesn't make sense, just pick out the parts that do and let me know what I said, will you?
Reply With Quote
  #44  
Old 06-14-2002, 11:05 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, you can replace the whole 'banner' stuff with a bit of code to call a template like any other.

It's that I'm too busy (WAY too busy) right now, and it being 2 am, or else I'd have fixed you up right away. As it is, I'll _try_ to get it done tomorrow, but you wouldn't believe my To-do list....

*sighs*

I'm 19 and there's 3 companies interested in me, now, and there's an average of 4 people a day asking me for stuff to make/design them... :bigsigh:
Reply With Quote
  #45  
Old 06-14-2002, 11:44 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You get some sleep and if you have some time, that would be great. If not, then I'll figure something else out. I don't even remember what it was like to be 19. Back then, we didn't have electricity. We had to watch televison by the kerosene lantern. Have a good one!
Reply With Quote
  #46  
Old 06-15-2002, 08:04 AM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, where the whole banner bit is, place this:


PHP Code:
eval("\$variablename .= \"".gettemplate("templatename")."\";"); 
And rename it to match your javascript-containing template.

Then just put $variablename where you want the whole template to be placed, and you're done.

was easier than I thought, heh
Reply With Quote
  #47  
Old 06-19-2002, 07:32 PM
FleaBag's Avatar
FleaBag FleaBag is offline
 
Join Date: Dec 2001
Posts: 1,674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My templated version working on 2.2.6. Thanks!
Reply With Quote
  #48  
Old 06-20-2002, 08:44 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cool, so this can be updated to a 2.2.6 hack, then?
Reply With Quote
  #49  
Old 07-17-2002, 08:09 AM
Warcaptain Warcaptain is offline
 
Join Date: Jul 2002
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great hack

and i love the flexibility of it :-D
Reply With Quote
  #50  
Old 09-03-2002, 03:56 PM
FleaBag's Avatar
FleaBag FleaBag is offline
 
Join Date: Dec 2001
Posts: 1,674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Working on 2.2.7.
Reply With Quote
  #51  
Old 09-08-2002, 12:16 PM
PHiXTiT PHiXTiT is offline
 
Join Date: Sep 2002
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 02:41 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08002 seconds
  • Memory Usage 2,323KB
  • Queries Executed 25 (?)
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
  • (4)bbcode_php
  • (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
  • (4)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_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