XF 2.0 Giving image badges to users

Frode789

Well-known member
Adding image banners to user groups is simple enough (special groups such as admin, donator etc). But how can I add it to users that has X amount of posts, given automatically? The whole user ladder system is so lackluster. I'd like to assign image banners (and text title) to users.
Image A + "Recruit" rank - 0 posts
Image B + "Member" rank - 25 posts
etc.
 
You'd need an add-on to extend the ladder system, rather lackluster at the moment.

Why not set up user groups for each rank, then use user group promotions:

use:

User has posted at least X messages:

and

User has posted no more than X messages:
 
There's a macro for postbits, you would need to lookup which template that is. You could then do something like this
HTML:
<xf:if is="{$user.message_count} > X">
    //first badge
    <xf:elseif is="{$user.message_count} < X AND {$user.message_count} >= Y" />
    //second
    <xf:else />
    //default
</xf:if>
X,Y obviously your numbers. For more ranks, just copy elseif clause.
But yea, would agree with Russ, user groups are probably the way to go.
 
You'd need an add-on to extend the ladder system, rather lackluster at the moment.

Why not set up user groups for each rank, then use user group promotions:

use:

User has posted at least X messages:

and

User has posted no more than X messages:

Yeah I tried this, but it only promoted like two users.. Not sure what I did wrong here..


Sigh, if only they could have a proper ladder system...
 
Ok, so I got this working.

The next question is, how can I limit them to a maximum of 3 badges in thread view? It would look extremely chaotic if members shows up with 4-5 badges there :P But show all badges in hover view and profile view.
 
Well, create a counter and everytime a badge is displayed, decrease that. Something like..

HTML:
<xf:set var="$max">3</xf:set>
<xf:if is="{$user.message_count} > X AND {$max}">
    //first badge
    <xf:set var="$max" value="{{$max - 1}}" />
    <xf:elseif is="{$user.message_count} < X AND {$user.message_count} >= Y AND {$max}" />
    //second
    <xf:set var="$max" value="{{$max - 1}}" />
    <xf:elseif is="$max" />
    //default
</xf:if>

Another approach could be to generate an array of badges, loop through that and in every loop count decrease the counter aswell. But that's an exercise for someone else :whistle:
 
Back
Top Bottom