• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Exclude button access to specific group

kankan

Active member
#1
Hello,

In a DIV block, i would like to make this button appears to all group except visitors :

Code:
<a class="button primary MenuCloser" href="http://www.forum-des-portables-asus.fr/www/quotes/create-quote"> Ajouter une citation </a></center>
    </div>
I have modified in this way :

Code:
<xen:if is="!{xen:helper ismemberof, $visitor, 1}"><a class="button primary MenuCloser" href="http://www.forum-des-portables-asus.fr/www/quotes/create-quote"> Ajouter une citation </a></center>
  </xen:if>
But when reloading page i have this error :

Template Errors: xenquote_sidebar_random_quote
  1. Argument 1 passed to XenForo_Template_Helper_Core::helperIsMemberOf() must be an array, null given in /home/e-smith/files/ibays/forumasus/html/www/library/XenForo/Template/Helper/Core.php, line 1153
  2. Argument 1 passed to XenForo_Model_User::isMemberOfUserGroup() must be an array, null given, called in /home/e-smith/files/ibays/forumasus/html/www/library/XenForo/Template/Helper/Core.php on line 1161 and defined in /home/e-smith/files/ibays/forumasus/html/www/library/XenForo/Model/User.php, line 1384
All code is the following :

Code:
<xen:require css="xenquote_sidebar_random_quote.css" />

<xen:if is="{$quote}">
    <div class="randomQuotation">
        <span class="quotation">
            {xen:raw $quote.renderedQuotation}
        </span><br>
        <!--<div class="attribution"><br>
            {xen:raw $quote.renderedAttribution} <span class="muted">(<a href="{xen:link 'canonical:quotes/', $quote}" rel="canonical" class="dimmed">#{$quote.quote_id}</a>)</span>
        </div>--><br>
        <div class="footnote">
            {xen:phrase xenquote_added_this_quotation} <xen:username user="$quote.author" />  <xen:if is="{$quote.quote_date} > 0"><xen:datetime time="$quote.quote_date" /><br><a href="http://www.forum-des-portables-asus.fr/www/quotes/">Afficher toutes les citations</a></xen:if>
        </div><center><br>
<xen:if is="!{xen:helper ismemberof, $visitor, 1}"><a class="button primary MenuCloser" href="http://www.forum-des-portables-asus.fr/www/quotes/create-quote"> Ajouter une citation </a></center>
    </xen:if></div>
<xen:else />
    {xen:phrase xenquote_there_are_no_quotations_to_display}
</xen:if>
Thank you
 

Brogan

XenForo moderator
Staff member
#2
Just use this to block it from those who aren't logged in:
Code:
<xen:if is="{$visitor.user_id}">
This content will show to logged in members
</xen:if>