Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 04-11-2014, 02:36 AM
sadiq6210 sadiq6210 is offline
 
Join Date: Sep 2005
Posts: 684
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Navtabs disappeared in this page after upgrade to 4.2.2

I have this simple mod.
https://vborg.vbsupport.ru/showthread.php?t=247552

It was working perfect in v4.2.1 but after upgrade to vbulletin 4.2.2 the navbar disappeared only with this mod (there is no buttons in the navbar)




The mod is simple i.e only xml file / no PHP files / 1 template only.
This is all the code inside the xml product, if somebody can help and find what is the wrong with this code

Code:
<product productid="ib_mynotes" active="1">
<title>IB myNotes</title>
<description>Scratch space for users</description>
<version>1.0</version>
<url/>
<versioncheckurl/>
<dependencies>
<dependency dependencytype="mysql" minversion="5.0.0" maxversion=""/>
<dependency dependencytype="php" minversion="5.0.0" maxversion=""/>
<dependency dependencytype="vbulletin" minversion="3.7.0" maxversion=""/>
</dependencies>
<codes>
<code version="1.0">
<installcode>
<![CDATA[
#################### CREATE MYNOTES TABLE ####################
 $vbulletin->db->query_write("
 CREATE TABLE IF NOT EXISTS " . TABLE_PREFIX . "mynotes (
 `userid` int(10) unsigned NOT NULL auto_increment,
 `notes` mediumtext,
 PRIMARY KEY (`userid`)
 )
 ");
]]>
</installcode>
<uninstallcode/>
</code>
</codes>
<templates>
<template name="mynotes_add_notes" templatetype="template" date="1280338664" username="admin" version="1.0">
<![CDATA[
{vb:stylevar htmldoctype}
 <html dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}">
 <head>
 <title>{vb:raw vboptions.bbtitle}</title>
 {vb:raw headinclude}
 </head>
 <body>
 {vb:raw header}
 
 {vb:raw navbar}
 
 <form class="vbform block"name="mynotes_form" method="post" id="mynotes_form" action="forum.php?do=savenotes&amp;product=notes">
 <div>
 <h2 class="blockhead">
 My Notes
 </h2>
 </div>
 <div class="blockbody formcontrols">
 
 {vb:raw spacer_open}
 
 <div class="blockrow" align="center">
 <vb:if condition="$notes_saved">
 <span style="padding-top: 5px; color: red; font-weight: bold;">Notes saved successfully!</span>
 </vb:if>
 <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
 <input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
 <input type="hidden" name="do" value="savenotes" />
 <textarea name="notes" id="notes" style="width: 730px; height: 400px;">{vb:raw note}</textarea>
 </div>
 </div><br/>
 
 <div align="right">
 <input class="button" type="submit" value="Save changes" />
 <input class="button" type="reset" value="Cancel" />
 </div>
 </form>
 {vb:raw footer}
 </body>
 </html>
]]>
</template>
</templates>
<stylevardfns></stylevardfns>
<stylevars></stylevars>
<plugins>
<plugin active="1" executionorder="5">
<title>myNotes Controller</title>
<hookname>global_setup_complete</hookname>
<phpcode>
<![CDATA[
if ($_REQUEST['product']=='notes')
 {
 global $vbulletin;
 
 // Allows proper template caching for the default action (showgarageportal) if no action is specified
 if (!empty($_REQUEST['do']) AND !isset($actiontemplates["$_REQUEST[do]"]))
 {
 $actiontemplates["$_REQUEST[do]"] =& $actiontemplates['shownotes'];
 }
 
 // Fall through default
 if (empty($_REQUEST['do'])) $_REQUEST['do'] = 'shownotes';
 
 // Start store notes
 if ($_POST['do'] == 'savenotes') 
 {
 $vbulletin->input->clean_array_gpc('p', array(
 'securitytoken'	 => TYPE_STR,
 'notes'	 => TYPE_STR,	 
 ));
 
 // Not logged in? You can't be here - display an error with a login dialog
 if (!$vbulletin->userinfo['userid']) print_no_permission();
 
 // Add or update my notes
 
 $note= myNotes::saveNotes($vbulletin->GPC['notes']);
 
 if($note->userid) $notes_saved = true;
 
 //exec_header_redirect(THIS_SCRIPT . '.php');
 
 $navbits = Array(
 'forum.php?' . $vbulletin->session->vars['sessionurl'] => 'My Notes',
 //'mynotes.php?' . $vbulletin->session->vars['sessionurl'] . "do=addvehicle&vehicleid=" . $vehicle->id => "Modify " . $vbphrase['garage_vehicle'],
 );
 
 
 $navbits = construct_navbits($navbits);
 
 //eval('$navbar = "' . fetch_template('navbar') . '";');
 $templater = vB_Template::create('navbar');
 $templater->register('note', $note);
 $templater->register('notes_saved', $notes_saved);
 $templater->register('navbits', $navbits);
 $navbar = $templater->render();
 //eval('print_output("' . fetch_template('mynotes_add_notes') . '");'); 
 $templater = vB_Template::create('mynotes_add_notes');
 $templater->register_page_templates(); 
 $templater->register('note', $note->notes);
 $templater->register('notes_saved', $notes_saved);
 $templater->register('navbits', $navbits);
 $templater->register('navbar', $navbar);
 print_output($templater->render());
 
 }
 
 // Sstart add notes
 if ($_REQUEST['do'] == 'shownotes')
 {
 // Not logged in? You can't be here - display an error with a login dialog
 if (!$vbulletin->userinfo['userid']) print_no_permission();
 
 $note = myNotes::getNotes((int)$vbulletin->userinfo['userid']);
 $navbits = Array(
 'forum.php' . $vbulletin->session->vars['sessionurl'] => 'My Notes',
 );
 
 $navbits = construct_navbits($navbits);
 
 //eval('$navbar = "' . fetch_template('navbar') . '";');
 $templater = vB_Template::create('navbar');
 $templater->register('note ', $note);
 $templater->register('navbits', $navbits);
 $navbar = $templater->render(); 
 
 //eval('print_output("' . fetch_template('mynotes_add_notes') . '");'); 
 $templater = vB_Template::create('mynotes_add_notes');
 $templater->register_page_templates(); 
 $templater->register('note', $note->notes);
 $templater->register('navbits', $navbits);
 $templater->register('navbar', $navbar);
 print_output($templater->render());
 }
 }
]]>
</phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Define myNotes class</title>
<hookname>init_startup</hookname>
<phpcode>
<![CDATA[
if ($_REQUEST['product'] == 'notes') 
 {
 class myNotes 
 {
 public function __construct() {	}
 
 public function __destruct() {	}
 
 public static function getNotes($noteid) 
 {
 if (!is_integer($noteid)) throw new Exception("Parameter 1 (noteid) must be an integer");
 
 global $vbulletin;
 
 $sql = "
 SELECT	 *
 FROM	 " . TABLE_PREFIX . "mynotes mn
 WHERE	 mn.userid = '$noteid'
 ";
 
 $v = $vbulletin->db->query_read($sql);
 
 if ($note = $vbulletin->db->fetch_array($v))
 {
 return (object)$note;
 }
 else
 {
 //standard_error('');
 }	
 }
 
 public static function saveNotes($notes) 
 {
 global $vbulletin;
 
 $sql = "
 REPLACE INTO " . TABLE_PREFIX . "mynotes (userid, notes)
 VALUES(
 '". $vbulletin->userinfo['userid'] ."', '". $vbulletin->db->escape_string($notes) ."')
 ";
 
 //die;
 
 $vbulletin->db->query_write($sql);
 if($vbulletin->db->affected_rows())
 {
 return myNotes::getNotes((int)$vbulletin->userinfo['userid']);
 }	 
 }
 }
 }
]]>
</phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Insert navbar link</title>
<hookname>parse_templates</hookname>
<phpcode>
<![CDATA[
$template_hook['navbar_buttons_right'] .= '<td class="vbmenu_control"><a href="forum.php?do=shownotes&amp;product=notes">My Notes</a></td>';
]]>
</phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Navbar Button</title>
<hookname>process_templates_complete</hookname>
<phpcode>
<![CDATA[
$tabselected = '';
 if ($_REQUEST['product']=='notes') 
 { 
 $vbulletin->options['selectednavtab']='my_notes'; 
 $tabselected = ' class="selected"'; 
 
 } 
 $template_hook['navtab_end'] .= '<li'.$tabselected.'><a href="forum.php?do=shownotes&amp;product=notes" class="navtab">My Notes</a></li>';
]]>
</phpcode>
</plugin>
</plugins>
<phrases></phrases>
<options></options>
<helptopics></helptopics>
<cronentries></cronentries>
<faqentries></faqentries>
</product>

I know the correct place to post this is inside the mod thread and I did but no response from 10 months, I will appreciate if any coder can help here

Thanks
Attached Images
File Type: png notes2.PNG (10.8 KB, 0 views)
Reply With Quote
  #2  
Old 04-12-2014, 06:39 PM
squidsk's Avatar
squidsk squidsk is offline
 
Join Date: Nov 2010
Posts: 969
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to use the navigation manager to add nav tabs. My guess is they removed the remaining obsolete template hooks from the navigation template so you're mod no longer works.
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:31 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.03738 seconds
  • Memory Usage 2,215KB
  • Queries Executed 14 (?)
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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (1)postbit_attachment
  • (2)postbit_onlinestatus
  • (2)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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete