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

XF 1.1 Trying to figure out code for ignored users

Discussion in 'Styling and Customization Questions' started by Mr. Wah, Jul 11, 2013.

  1. Mr. Wah

    Mr. Wah Member

    Apologies if this is in the wrong forum

    Been stumped on this for a bit. So I have a forloop that lists a set number of items. I want it to check if the item it is about to render is from a user who is on the visitor's ignore list. Here's the original code which did not hide the messages if a user was on the ignore list.

    Code:
                    <li>
                        <xen:avatar user="$update" size="s" img="true" />
                        <a href="{xen:link members, $update}" class="username" style="display: inline;">{xen:helper richUserName, $update}</a>
                        <span class="userTitle">{$update.message} (<xen:datetime time="$update.post_date" />)</span>
                    </li>
    I then tried the following code, but it listed all the messages as the ignore message, even those who weren't on the visitor's ignore list:

    Code:
                    <li>
                                          <xen:if is="{$update.message.isIgnored}">
                                          {xen:phrase you_are_ignoring_content_by_this_member}               
                                          <xen:else />
                        <xen:avatar user="$update" size="s" img="true" />
                        <a href="{xen:link members, $update}" class="username" style="display: inline;">{xen:helper richUserName, $update}</a>
                        <span class="userTitle">{$update.message} (<xen:datetime time="$update.post_date" />)</span>                                      
                                          </xen:if>
                    </li>
    Any help in understanding either whatever syntax or pseudo issue I'm missing, would be appreciated.
     
    Last edited: Jul 11, 2013
  2. Syndol

    Syndol Guest

    Try
    <xen:if is="{xen:helper isIgnored, $update.user_id}">
     
    Tracy Perry likes this.
  3. Mr. Wah

    Mr. Wah Member

    Thanks, that did it!

    Would you mind explaining why it worked though, I just want to get a better understanding of the code.
     
  4. Syndol

    Syndol Guest

    It simply checks the visitor's ignore list against the user you provide.
    The function is located in Template/Helper/Core.php
    and is named helperIsIgnored()
     

Share This Page