vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   In or Out? Hack-Version 1.1 (https://vborg.vbsupport.ru/showthread.php?t=41967)

ladyfyre 08-05-2002 10:00 PM

In or Out? Hack-Version 1.1
 
Ok all...this is my VERY first hack written all by myself...so if it sucks, don't pick on me!!!!!

What it does: Well, the primary purpose is to give you separate user navigation/button bar for users who are logged in vs. users who have not registered or are not logged in.
**hint** this could also be used to encourage users to register. You can also add banners at the bottom of the unreg_navbar template which will appear to non-members, but will not appear to members. As they say...membership has it's priviledges :)

Now...my own site is EXTENSIVELY hacked. Many template changes and a few VERY minor hacks here and there of my own invention, along with 35+ hacks from here. If the code in the templates doesn't work perfectly for your site, feel free to change it around. You can also choose to simply copy the code you are currently using in your header file, and delete whatever doesn't apply to each group for that template.
In my version, I have prefixed each image with the imagesfolder replacement code. This is because I offer my users several styles to choose from, and this allows me to easily implement new styles without having things get wonky. Feel free to remove that part if you wish.

Time to implement: about 5 minutes.
Files edited: global.php (1 addition, 1 insertion)
templates edited: header
templates added: loggedin_navbar and unreg_navbar


Ok...here are the steps we need to take:

1. create a new template called loggedin_navbar and paste the contents of the .txt file by that name inside it.
2. create a new template called unreg_navbar and paste the contents of the .txt file by that name inside it.
3. BACKUP YOUR ORIGINAL FIRST, then open global.php and do the following:

Find this section:

PHP Code:

// ###################### Start templates #######################
//prepare default templates **********************
if ($templatesused!='') {
  
$templatesused.=',';


Just after it, the line begins like this:

PHP Code:

$templatesused.='gobutton,timezone,username_loggedout,username_loggedin,phpinclude,headinclude,header,footer 

Insert this:

loggedin_navbar,unreg_navbar,

after header, but before footer in that line.

Still in global.php

Find This:

PHP Code:

// parse PHP include ##################
eval(gettemplate('phpinclude',0,0)); 

Add After it:

PHP Code:

//In or Out Hack
if ($bbuserinfo['userid']<1) {
eval(
"\$menu_navbar = \"".gettemplate("unreg_navbar")."\";");
} else {
eval(
"\$menu_navbar = \"".gettemplate("loggedin_navbar")."\";");
}
//In or Out Hack 


4. Last but not least...

Edit your header template.

You can remove everything between these lines:

PHP Code:

<!-- logo and buttons -->
<!-- 
logo and buttons --> 

and replace them with this:

PHP Code:

$menu_navbar 

and that is all there was to it.

yeah...i know....kid stuff here...but everyone has to start somewhere..and since most of what i have hacked into our boards is only really applicable there, I am glad to finally have something to share here, since the folks here have given so much to me and my site!!!

If support or help is needed, post it here, and I will happily help if I can :)
Zip and instructions update to include merge the two variables into one.

ladyfyre 08-06-2002 05:10 AM

Screenshot of view when logged in:

ladyfyre 08-06-2002 05:11 AM

Screenshot of user logged out or unregistered:

DestyNova 08-06-2002 05:28 AM

Nice small hack

:thumb up: =)

snyx 08-06-2002 05:51 AM

love it, installing it now :)

Dean C 08-06-2002 06:16 AM

:D

Chris M 08-06-2002 09:30 AM

Nice:)

But you could easily do this in the phpinclude template:)

Satan

ladyfyre 08-06-2002 09:56 AM

thx to all for the support :)

hellsatan: you are correct, i could have...but i prefer not to use the PHP include unless there is a good reason. My site averages about 200-340 users online at any given time, and despite being on a colocated server, we are seriously in need of a server upgrade, and i have to really watch resources.

Using phpinclude means that the entire phpinclude is loaded into every page, according to my understanding.

Also according to my understanding, routines put into the global.php file are not accessed EVERY time a page loads....but only when they are called.

by all means feel free to correct me if i am wrong on this one.

ladyfyre 08-06-2002 09:59 AM

for those who prefer hellsatan's way of using phpinclude, follow all the same steps listed above EXCEPT Step 3.

The alternative to step 3 is putting the following code in your phpinclude template, at the very bottom:

PHP Code:

if ($bbuserinfo['userid']<1

eval(
"\$unreg_navbar = \"".gettemplate("unreg_navbar")."\";");  

else {  
eval(
"\$loggedin_navbar = \"".gettemplate("loggedin_navbar")."\";");  



DemiNeo0101 08-06-2002 01:18 PM

Great Job Ladyfyre. This will be really handy for my site. I have alot of Buttens on my nav bar that only work for members. Thanks for releasing it.


All times are GMT. The time now is 08:54 PM.

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.01176 seconds
  • Memory Usage 1,745KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete