Rank System

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Rank System

Pedro <Nabble>
This is possible with NAML. A very simple change is:

(1) Open the NAML code of your app (click on the "See how NAML generates this page" link on the footer)
(2) Find the post_count_js macro (click on the options dropdown and then "Search macros")
(3) Enter the code below and edit it as you want:
<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]"/>');
			
				$div.append("<br/>");
				var postCount = <n.page_user.post_count_value/>;
				if (postCount > 300)
					$div.append("Elite Member");
				else if (postCount > 200)
					$div.append("Guru");
				else if (postCount > 100)
					$div.append("Master");
				else if (postCount > 50)
					$div.append("Helper");
				else
					$div.append("Newbie");
			</then>
		</n.if.not.page_user.is_deactivated>
	</n.param_loop.>
</override_macro>
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Rank System

Pedro <Nabble>
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.