Rank System

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

Rank System

Pedro
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
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.
Reply | Threaded
Open this post in threaded view
|

Re: Rank System

OS-Jason
I know this post is many years old, but does this still work?

I added the code, but seems not to be working.

EDIT: Seems the first code works, but the code that has the stars in it does not work.
Reply | Threaded
Open this post in threaded view
|

Re: Rank System

GregChapman
I confess to trying both but failed to get either to work, (but that was on my test forum where there is only me posting messages).

I did try amending the image code in the second but still it did not work. (I uploaded my own 10px star image to my forum and then edited the URL in the macro to point to that image.)

If you got the first to work then I guess I'm doing something wrong!
Volunteer Helper - but recommending that users move off the platform!
Once the admin for GregHelp now deleted.
Reply | Threaded
Open this post in threaded view
|

Re: Rank System

OS-Jason
GregChapman wrote
I confess to trying both but failed to get either to work, (but that was on my test forum where there is only me posting messages).

I did try amending the image code in the second but still it did not work. (I uploaded my own 10px star image to my forum and then edited the URL in the macro to point to that image.)

If you got the first to work then I guess I'm doing something wrong!
I don't know, it seems to be working. I'll let you know better when I actually get other people visiting my site.