{$canSearch} not working?

Astrum

Active member
Alright, I'm not sure if this is a bug or I'm going crazy. I'm trying to add a sub-navigation tab inside of <xen:if is="{$canSearch}">blah blah blah</xen:if>. Now presumably this should work as not too far above it a sub-navigation tab does the same thing, namely this bit under the Forums tab:

Code:
<xen:if is="{$canSearch}"><li><a href="{xen:link search, '', 'type=post'}">{xen:phrase search_forums}</a></li></xen:if>

Now the problem is that while the search forums subnav works just fine, only displaying to those who are allowed to search, any custom tab using this permission will never be shown.

So am I losing my mind or is the $canSearch being removed from the params array right after it's used in the Forums navigation group?
 
$canSearch isn't available to your template.

You'll need to hook into the template_create event and add that parameter.
 
I don't think a linksTemplate goes through template_create, I tried monitoring for it and it never went through. I looked at HtmlPublic.php and found:

PHP:
$extraTab['linksTemplate'] = $this->createTemplateObject($extraTab['linksTemplate'], $extraTab);

So it's passing $extraTab as the parameters. I'm just setting $extraTab['canSearch'] = $visitor->canSearch() and it works fine.
 
Top Bottom