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

Bug in "hide signature" function

Discussion in 'XenForo Questions and Support' started by fredrikse, Jan 6, 2013.

  1. fredrikse

    fredrikse Active Member

    Hi,

    I have created a template modification with TMS that will hide signature in message view based on if you are member of a certain user group.

    This is the code I'm using for the function:
    PHP:
    <xen:if is="{xen:helper ismemberof, $visitor, 12}">
    <
    xen:if is="{$message.signature}">
                <
    div class="baseHtml signature ugc{xen:if $message.isIgnored, ' ignored'}"><aside>{xen:raw $message.signatureHtml}</aside></div>
            </
    xen:if>
    </
    xen:if>
    At the beginning I though I got it right. But now when I verified and looked more closely I realized that it's not working like it should. I have to users which both have a valid signature in their profiles. Profile A is member of a usergroup which will permit it to display the signature. Profile B is member of the same group. Here's the funny thing. When I remove Profile A from this usergroup the signature disappears in the thread like it should do. But signature disappears for Profile A as well. Really strange. I'm missing something in my condition.

    Help is greatly appreciated! What I need is secondary user group information for each and every user in a thread I guess. Right? :)
     
  2. James

    James Well-Known Member

    It may be because you're using $visitor which is the user currently viewing the page.

    Use $user to identify the message author, or $message may also return the user information.
     
  3. fredrikse

    fredrikse Active Member

    I tried $user instead of $visitor, but that didn't do it. Maybe it's not available in the template? Is it possible to get secondary user group info from $message?
     
  4. James

    James Well-Known Member

    If $user isn't available, try $message. $user should be available, though.
     
  5. fredrikse

    fredrikse Active Member

    The server won't save $message.$user. I get a time out. Is it because the variable is not valid? When I save $visitor it works.
     
  6. James

    James Well-Known Member

    It's $message alone, the backend XF template handler will search the array for the required user info.
     
    fredrikse likes this.
  7. fredrikse

    fredrikse Active Member

    Now it works like a charm! Many thanks to you (y)
     

Share This Page