vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Create a New Tab in the navbar (https://vborg.vbsupport.ru/showthread.php?t=226914)

Lynne 07-17-2011 04:00 PM

Do a search in this thread for "is_member_of" because that is what you would use in the condition and I know this has been covered before in this thread.

mhudson 07-17-2011 05:19 PM

ah thanks Lynne. I kinda skimmed though the thread 30 pages is a lot to take in.

all sorted now :) works perfectly

Spyike 07-18-2011 07:15 PM

Can somebody tell me what is wrong with my code? I keep getting a syntax error and cannot seem to see where I made an error..

Code:

if (is_member_of($vbulletin->userinfo, 1))
{
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'spyikereg')
{
    $vbulletin->options['selectednavtab']='spyreg';
    $tabselected = ' class="selected"';
}
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://spyike.org/register.php">Register</a>'.$tablinks.'</li>' ;


Lynne 07-18-2011 08:32 PM

Quote:

Originally Posted by Spyike (Post 2222089)
Can somebody tell me what is wrong with my code? I keep getting a syntax error and cannot seem to see where I made an error..

Code:

if (is_member_of($vbulletin->userinfo, 1))
{
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'spyikereg')
{
    $vbulletin->options['selectednavtab']='spyreg';
    $tabselected = ' class="selected"';
}
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://spyike.org/register.php">Register</a>'.$tablinks.'</li>' ;


You forgot the ending } to your is_member_of condition. :)

cellarius 07-18-2011 08:33 PM

1. Why don't you give the exact error message instead if making us search & guess?
2. Use indenting to make your code more readable.
3. You're missing a closing curly bracket at the end, that's for sure.

// Edit: Lynne beat me to it :D

Spyike 07-18-2011 10:00 PM

Quote:

Originally Posted by Lynne (Post 2222111)
You forgot the ending } to your is_member_of condition. :)

Where does it belong..?

Thank you for the quick response.

HMBeaty 07-18-2011 10:05 PM

Quote:

Originally Posted by Spyike (Post 2222157)
Where does it belong..?

Thank you for the quick response.

Your code should look like:
PHP Code:

if (is_member_of($vbulletin->userinfo1))
{
    
$tabselected '';
    
$tablinks '';

    if (
THIS_SCRIPT == 'spyikereg')
    {
        
$vbulletin->options['selectednavtab']='spyreg';
        
$tabselected ' class="selected"';
    } 

    
$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://spyike.org/register.php">Register</a>'.$tablinks.'</li>' ;



Spyike 07-18-2011 10:07 PM

Quote:

Originally Posted by HMBeaty (Post 2222159)
Your code should look like:

Greatly appreciate it, thanks.

HMBeaty 07-18-2011 10:07 PM

Quote:

Originally Posted by Spyike (Post 2222163)
Greatly appreciate it, thanks.

No problem :)

Lynne 07-18-2011 10:09 PM

Quote:

Originally Posted by Spyike (Post 2222157)
Where does it belong..?

Thank you for the quick response.

It belongs at the very, very end. It should be your last line in the plugin.

edit: Well, I guess while I was typing Brooks was being the young whippersnapper he is and answering way, waaaaay faster than me!


All times are GMT. The time now is 01:02 AM.

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.01931 seconds
  • Memory Usage 1,742KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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