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

Picture that changes with post count?

Discussion in 'Styling and Customization Questions' started by JABRONI, Feb 2, 2012.

  1. JABRONI

    JABRONI Well-Known Member

    Okay, so I want to put a ranking system according to post count in my Message User Info. The rank would increase once you reach a certain number of posts.

    1 Post = [​IMG]

    2 Post = [​IMG]

    etc...

    is there a code that I could use for this to work?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> message_user_info

    Add the red code:

    Code:
    	<xen:if hascontent="true">
    		<div class="extraUserInfo">
    			<xen:contentcheck>
    			<xen:hook name="message_user_info_extra" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
    				<xen:if is="{$user.message_count} > 40">
    					<dl class="pairsInline">
    						<dt>Rank:</dt>
    						<dd>1</dd>
    					</dl>
    				<xen:elseif is="{$user.message_count} > 10" />
    					<dl class="pairsInline">
    						<dt>Rank:</dt>
    						<dd>2</dd>
    					</dl>
    				<xen:elseif is="{$user.message_count} > 3" />
    					<dl class="pairsInline">
    						<dt>Rank:</dt>
    						<dd>3</dd>
    					</dl>
    				<xen:else />
    					<dl class="pairsInline">
    						<dt>Rank:</dt>
    						<dd>Lowest</dd>
    					</dl>
    				</xen:if>
    				<xen:if is="@messageShowRegisterDate">
    					<dl class="pairsInline">
    						<dt>{xen:phrase member_since}:</dt>
    						<dd>{xen:date $user.register_date}</dd>
    					</dl>
    				</xen:if>
    				
    				<xen:if is="@messageShowMessageCount">
    					<dl class="pairsInline">
    						<dt>{xen:phrase message_count}:</dt>
    						<dd><a href="{xen:link search/member, '', 'user_id={$user.user_id}'}" class="concealed">{xen:number $user.message_count}</a></dd>
    					</dl>
    				</xen:if>
    
    Add more xen:elseif's to add more post count boundaries and ranks.

    The result:

    Screen shot 2012-02-01 at 9.03.31 PM.png
     
    Martry, psx, Shelley and 4 others like this.
  3. Divvens

    Divvens Well-Known Member

    Can the same be done for Trophy Points?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Yes. Use {$user.trophy_points} instead of {$user.message_count}.
     
    CapnLuffy likes this.
  5. JABRONI

    JABRONI Well-Known Member

    Also, is there a way to make it so it is = to a certain amount of posts? Every time that I try and put an equal sign, I get an error.
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    {$user.message_count} == 40
     
  7. JABRONI

    JABRONI Well-Known Member

    Wow, you are REALLY quick on responding haha, thanks!

    I have another question though,

    I'm trying to get 50 different ranks for my members based on a post count that I have pre-determined here,

    Now, whenever I put this,

    Code:
                                    <xen:if is="{$user.message_count} > 1">
                        <dl class="pairsInline">
                            <dt>Rank:</dt>
                            <dd><img src="http://dl.dropbox.com/u/3357109/Ranks/Rank1.png" height="17px" width="17px"></img></dd>
                        </dl>
                    <xen:elseif is="{$user.message_count} > 2" />
                        <dl class="pairsInline">
                            <dt>Rank:</dt>
                            <dd><img src="http://dl.dropbox.com/u/3357109/Ranks/Rank2.png" height="17px" width="17px"></img></dd>
                        </dl>
                    <xen:elseif is="{$user.message_count} > 3" />
                        <dl class="pairsInline">
                            <dt>Rank:</dt>
                            <dd><img src="http://dl.dropbox.com/u/3357109/Ranks/Rank3.png" height="17px" width="17px"></img></dd>
                        </dl>
                    <xen:else />
                        <dl class="pairsInline">
                            <dt>Rank:</dt>
                            <dd>Lowest</dd>
                        </dl>
                    </xen:if>
    Everyone's rank is 1 on the site instead of the increasing number,

    [​IMG]

    Why is that? I understand that I haven't added all the ranks but shouldn't they both be Rank 3 and not Rank 1?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You need to check the counts in descending order, not ascending. 3,2,1 instead of 1,2,3,
     
  9. SchmitzIT

    SchmitzIT Well-Known Member

    Elseif will mean that as soon as the first true condition is reached, the check will exit.

    Seeing everyone has 1 post, that's the only branch of the if statement that gets tested, found to be true, and thus the loop is exited. To solve it, like Jake said, add the values in reverse order.
     
  10. thebush

    thebush Member

    Awesome TUT!
     
  11. JABRONI

    JABRONI Well-Known Member

    Awesome, thank you Jake & Schmitz! It was working great!
     
  12. thebush

    thebush Member

    I want to replace:
    With an image, What's the correct code ?
     
  13. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Replace "Lowest" with an img tag:

    Code:
    <img src="path/to/image.gif" />
    
     
    thebush likes this.
  14. thebush

    thebush Member

    Without <dd></dd> ?
     
  15. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    With.
     
    thebush likes this.
  16. SchmitzIT

    SchmitzIT Well-Known Member

    It was all Jake. I didn't really do anything :)
     
  17. Robyn Unc Privette

    Robyn Unc Privette Active Member

    Every time I try this it will never save :( I get
     
  18. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  19. Weppa333

    Weppa333 Active Member

    wow, looks like many people were missing the good old "post medals" after all :)
    I know it's a cheesy way to reward users, but well it's understandable by everyone and sometimes even expected/requested by casual forum users, the ones with little forum experience. They rely on such "medals" to quickly identify "trustworthy" people in a community.

    My 2 cents of course,
     
  20. AndreaMarucci

    AndreaMarucci Well-Known Member

    Jake you're the best! Using your system I've implemented a ranking system that show different images on the user info area based on the number of posts of each user. Thank you very much...:)
     

Share This Page