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

Trophy Conditionals?

Discussion in 'XenForo Development Discussions' started by nrep, Sep 15, 2013.

  1. nrep

    nrep Well-Known Member

    Is there a way to get a list of all of the trophies a member has, or check for a specific trophy using the templates system?

    I've seen the trophies code, but wasn't sure if this is something I can add on to another page and re-use:

    Code:
            <ol class="overlayScroll">
            <xen:foreach loop="$trophies" value="$trophy">
                <li class="primaryContent">
                    <xen:include template="trophy" />
                </li>
            </xen:foreach>
    I'm looking at adding some code to the message_user_info template so that I can add an icon if a specific trophies have been awarded to that user.

    There's currently an addon by xfrocks that does something similar, but it's not quite what I'm after - so I'm trying to code my own. If there was a conditional I could use to check for a trophy awarded to the user in "message_user_info", then it should be easy enough to code. Or, perhaps a way to look through all of the trophies they have.
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    You'll need an add-on that modifies and fetches the trophies for an individual user via XenForo_Model_Trophy.
     
  3. nrep

    nrep Well-Known Member

    Ah, that's what I feared. I hoped there was a way I could check some sort of $user.trophy variable.

    Thanks for the help!
     

Share This Page