I finally figured out a way to add all my variables from my custom page to the navbar. I went about it in a sneaky way.
I first added the following code to my showroster.php file which allowed me to add all the registered variables I wanted to use:
PHP Code:
$accessgroups = explode(',', $vbulletin->options['showroster_access_groups']);
$navbarloc = $vbulletin->options['showroster_navbar_loc'];
switch ($navbarloc) {
case '1':
$nbloc = 'navtab_start'; break;
case '2':
$nbloc = 'navtab_middle'; break;
case '3':
$nbloc = 'navtab_end'; break;
}
if (THIS_SCRIPT == 'showroster') {
$vbulletin->options['selectednavtab'] = 'showroster';
}
$templater = vB_Template::create('showroster_navbar');
$templater->register('sorturl', $sorturl);
$templater->register('accessgroups', $accessgroups);
$templater->register('columns', $columns);
$templater->register('sortgroupfield', $sortgroupfield);
$templater->register('oppositesort', $oppositesort);
$template_hook[$nbloc] .= $templater->render();
Since that was a close repeat to the code in my plugin, I ended up having one Roster button when on another tab and two when viewing the roster. I tried to remove the plugin, but that then caused the button to be missing when on another page; although it was there when on the roster. It makes sense after the fact. So, after some thought, I changed my plugin to the following:
PHP Code:
if (THIS_SCRIPT != 'showroster') {
$accessgroups = explode(',', $vbulletin->options['showroster_access_groups']);
$navbarloc = $vbulletin->options['showroster_navbar_loc'];
$navbarorder = $vbulletin->options['showroster_navbar_order'];
switch ($navbarloc) {
case '1':
$nbloc = 'navtab_start'; break;
case '2':
$nbloc = 'navtab_middle'; break;
case '3':
$nbloc = 'navtab_end'; break;
}
$templater = vB_Template::create('showroster_navbar');
$templater->register('accessgroups', $accessgroups);
$template_hook[$nbloc] .= $templater->render();
}
That allowed me to use the plugin code when not on the roster page. When on the roster page, this code doesn't work, but the code from my showroster.php does. I then set up my showroster_navbar template to include the variables from my .php file and they work very well.
HTML Code:
<vb:if condition="is_member_of($bbuserinfo, $accessgroups)">
<vb:if condition="$vboptions['selectednavtab'] == 'showroster'">
<li class="selected">
<a class="navtab" href="showroster.php{vb:raw session.sessionurl_q}">Roster</a>
<ul class="floatcontainer">
<li><a href="showroster.php{vb:raw session.sessionurl_q}">Default Sort</a></li>
<li class="popupmenu">
<a href="javascript://" class="popupctrl">Sorting Options</a>
<ul class="popupbody popuphover">
<vb:if condition="$show[field1st]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column1]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts1}</vb:if>&sortgroupfield={vb:raw columns.column1}">{vb:raw columns.title1}</a></li></vb:if>
<vb:if condition="$show[field2nd]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column2]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts2}</vb:if>&sortgroupfield={vb:raw columns.column2}">{vb:raw columns.title2}</a></li></vb:if>
<vb:if condition="$show[field3rd]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column3]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts3}</vb:if>&sortgroupfield={vb:raw columns.column3}">{vb:raw columns.title3}</a></li></vb:if>
<vb:if condition="$show[field4th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column4]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts4}</vb:if>&sortgroupfield={vb:raw columns.column4}">{vb:raw columns.title4}</a></li></vb:if>
<vb:if condition="$show[field5th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column5]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts5}</vb:if>&sortgroupfield={vb:raw columns.column5}">{vb:raw columns.title5}</a></li></vb:if>
<vb:if condition="$show[field6th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column6]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts6}</vb:if>&sortgroupfield={vb:raw columns.column6}">{vb:raw columns.title6}</a></li></vb:if>
<vb:if condition="$show[field7th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column7]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts7}</vb:if>&sortgroupfield={vb:raw columns.column7}">{vb:raw columns.title7}</a></li></vb:if>
<vb:if condition="$show[field8th]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == $columns[column8]">{vb:raw oppositesort}<vb:else />{vb:raw columns.sorts8}</vb:if>&sortgroupfield={vb:raw columns.column8}">{vb:raw columns.title8}</a></li></vb:if>
<vb:if condition="$show[datejoinedcol]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == 'joindate'">{vb:raw oppositesort}<vb:else />{vb:raw columns.sortsdj}</vb:if>&sortgroupfield=joindate">{vb:rawphrase join_date}</a></li></vb:if>
<vb:if condition="$show[lastactivecol]"><li><a href="{vb:raw sorturl}&order=<vb:if condition="$sortgroupfield == 'lastactive'">{vb:raw oppositesort}<vb:else />{vb:raw columns.sortsla}</vb:if>&sortgroupfield=lastactive">{vb:rawphrase last_activity}</a></li></vb:if>
</ul>
</li>
</ul>
</li>
<vb:else />
<li><a class="navtab" href="showroster.php{vb:raw session.sessionurl_q}">Roster</a></li>
</vb:if>
</vb:if>
I'm not saying this is the best way, far from it. I would much rather have had a way to pull the data from my .php to the plugin and then use it in the template that way, but this works for now. I'll gladly accept a better way if someone can tell me. I'm sure I'm added more code than I need.