Picture that changes with post count?

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 =
Rank1.png


2 Post =
Rank2.png


etc...

is there a code that I could use for this to work?
 
Admin CP -> Appearance -> Templates -> message_user_info

Add the red code:

Rich (BB 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.webp
 
{$user.message_count} == 40

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,

1 - 1
2 - 2
3 - 3
4 - 4
5 - 5
6 - 6
7 - 7
8 - 8
9 - 9
10 - 10
11 - 15
12 - 20
13 - 25
14 - 30
15 - 35
16 - 40
17 - 45
18 - 50
19 - 55
20 - 60
21 - 70
22 - 80
23 - 90
24 - 100
25 - 150
26 - 200
27 - 250
28 - 300
29 - 350
30 - 400
31 - 450
32 - 500
33 - 550
34 - 600
35 - 650
36 - 700
37 - 750
38 - 800
39 - 850
40 - 900
41 - 1000
42 - 1200
43 - 1400
44 - 1600
45 - 1800
46 - 2000
47 - 2500
48 - 3000
49 - 3500
50 - 4000

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,

052646bbc972f103bd5c57c0837733bf.png


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?
 
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?

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.
 
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,
 
Top Bottom