Login  Register

Re: Rank System

Posted by Pedro on Feb 21, 2014; 11:48pm
URL: https://support.nabble.com/Rank-System-tp7589491p7589492.html

Using icons and text.

 Here I save an star image at icon variable. Then, depending on the number of posts I give the user a title, "Master" for example, and a quantity of icons.

<override_macro name="post_count_js">
    <n.param_loop. param="postCount">
        <n.if.not.page_user.is_deactivated>
            <then>
                var $div = $('div.post-count<n.page_user.user_tag_id/>');
                $div.html('<n.one_or_many n="[n.page_user.post_count_value/]" one_text="[t]post[/t]" many_text="[t]posts[/t]"/>');
                
                var icon = "<img alt='' src='images/icon_starred.png' width='10px' height='10px' />"
                
                $div.append("<br/>");
                var postCount = <n.page_user.post_count_value/>;
                if (postCount > 10)
                $div.append("Guru<br/>"+icon+icon+icon);
                else if (postCount > 5)
                $div.append("Master<br/>"+icon+icon);
                else if (postCount > 1)
                $div.append("Junior"+icon);
                
            </then>
        </n.if.not.page_user.is_deactivated>
    </n.param_loop.>
</override_macro>
My test forum.