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)

cellarius 03-31-2010 11:06 AM

Sorry, I mixed you up with jacx. Anyway, I posted the solution for your problem on the previous page of this thread, #199

Yonatan 03-31-2010 11:34 AM

Quote:

Originally Posted by cellarius (Post 2013382)
Sorry, I mixed you up with jacx. Anyway, I posted the solution for your problem on the previous page of this thread, #199

I got this error:
Quote:

Fatal error: Call to a member function getNodeId() on a non-object in /home/*username*/public_html/vb/includes/class_bootstrap.php(399) : eval()'d code on line 3
when I used this code.

this is my code:
PHP Code:

$tabselected '';
$tablinks '';
if (
in_array($this->content->getNodeId(), 5))  
{
    
$vbulletin->options['selectednavtab']='content.php?r=5';
    
$tabselected ' class="selected"';
    
$tablinks '';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="content.php?r=5">News</a>'.$tablinks.'</li>' 


jacx 03-31-2010 02:09 PM

Quote:

Originally Posted by Lynne (Post 2013240)
Why couldn't you link to that?


Instead of:
PHP Code:

<a href="/page.php">A page on your site</a

do:
PHP Code:

<a href="http://www.anothersite.com/page">A page on another site</a



when i tried that it took me to http://mysite.com/link.php

Edit...im trying to post the code i used and keep getting "Bad Request" when i do it..anyone know what im doing wrong so i can post what i had entered?

vglobal 03-31-2010 06:00 PM

Hi Lynne,

If I want only the user with id=1 to see the link. What I have to do?

Thanks.

Lynne 03-31-2010 06:59 PM

Quote:

Originally Posted by jacx (Post 2013478)
when i tried that it took me to http://mysite.com/link.php

Then you have a setting or modification that is doing that. If you have the link written as going to http://www.somesite.com/link.php then it should go there, not to your site.
Quote:

Originally Posted by vglobal (Post 2013600)
Hi Lynne,

If I want only the user with id=1 to see the link. What I have to do?

Thanks.

This was covered, I think, on page 2 or 3.

Jason92s 03-31-2010 07:08 PM

I created a PHP file with nothing in it but the following:

PHP Code:

<?php
define
('THIS_SCRIPT''locallinks');
?>

My plugin script has the following:

PHP Code:

if (THIS_SCRIPT == 'locallinks')
{
    
$vbulletin->options['selectednavtab']='locallinks'

At the bottom of the plugin is:

PHP Code:

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="/index.php?pageid=locallinks">Test Link</a>'.$tablinks.'</li>' 


When I click on my new tab, it highlights the Forum tab and shows all the regular stuff found under Forum (New Posts, Private Messages, FAQ, etc).

Any help is appreciated.

vglobal 03-31-2010 07:54 PM

Quote:

Originally Posted by Lynne (Post 2013625)
This was covered, I think, on page 2 or 3.

Thanks, but that is cover for usergroup.

I create new NavTab as follow, and I want only me to see the Chat Admin. Please help.
Code:

$tabselected = '';
                $tablinks = '';
                if (THIS_SCRIPT == 'chat')
                    {
                    $vbulletin->options['selectednavtab']='chat';
                    $tabselected = ' class="selected"';
                    $tablinks = ' <ul class="floatcontainer">
                        <li><a href="chat/admin.php" target="_blank">Chat Admin</a></li></ul> ';
                    } 
                $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="chat.php">Chat</a>'.$tablinks.'</li>' ;


Lynne 03-31-2010 11:42 PM

Quote:

Originally Posted by Jason92s (Post 2013629)
I created a PHP file with nothing in it but the following:

PHP Code:

<?php
define
('THIS_SCRIPT''locallinks');
?>


According to your code, your page is located at http://yoursite.com/index.php?pageid=locallinks Yet, I'm guessing that is not the link to your actual php page you created above? You you get sent to index.php which is probably forwarded to your forum.php page (check the script) and thus the Forum tab gets highlighted.
Quote:

Originally Posted by vglobal (Post 2013664)
Thanks, but that is cover for usergroup.

I create new NavTab as follow, and I want only me to see the Chat Admin. Please help.
Code:

$tabselected = '';
                $tablinks = '';
                if (THIS_SCRIPT == 'chat')
                    {
                    $vbulletin->options['selectednavtab']='chat';
                    $tabselected = ' class="selected"';
                    $tablinks = ' <ul class="floatcontainer">
                        <li><a href="chat/admin.php" target="_blank">Chat Admin</a></li></ul> ';
                    } 
                $template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="chat.php">Chat</a>'.$tablinks.'</li>' ;


Instead of this sort of condition:
PHP Code:

if (is_member_of($vbulletin->userinfo567)) 

You would use this sort of condition:
PHP Code:

if ($vbulletin->userinfo['userid'] == 1

You probably want to wrap that condition around the full contents of the plugin if it is only to show for that userid.

vglobal 03-31-2010 11:47 PM

Thank you very much.

Jason92s 04-01-2010 03:49 PM

Thanks for the reply Lynne...I actually have no clue what I'm doing (is it that obvious?). I just want to have a new link called Local Links that when clicked will show 4 new sublinks with their own links. On the new tab I really don't need it to display any content when it's clicked, just the links. Is this the right mod for me? Thanks again.


All times are GMT. The time now is 05:50 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.03637 seconds
  • Memory Usage 1,770KB
  • 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
  • (9)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)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