sadiq6210
04-11-2014, 02:36 AM
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)
https://vborg.vbsupport.ru/attachment.php?attachmentid=148764&stc=1&d=1397187038
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
<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&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&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&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
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)
https://vborg.vbsupport.ru/attachment.php?attachmentid=148764&stc=1&d=1397187038
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
<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&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&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&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