Custom Images for User groups

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

Custom Images for User groups

mz555
This post was updated on .
Hi, I was wondering if there is a way to add custom images to each user group on my forum.
I want it to reflect a ranking system, where say if you are just a registered user you have a picture of 1 star, but if you are a senior member you get a picture of 2 stars, and so on.
Is there a way I can implement this?

-----
UPDATE:

I found this code on another thread which seems to do exactly what I want, but is missing a few thing:

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

I just need one more thing: what do I need to add to the code so that for each "rank" (e.g. Master) there is a custom image under it, like the star thing i mentioned above?
Reply | Threaded
Open this post in threaded view
|

Re: Custom Images for User groups

Pedro
Here is a quick example:
<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 > 100){
                    $div.append("Master");
                    addStar(3);
                }
                else if (postCount > 50){
                    $div.append("Helper");
                    addStar(2);
                }
                else {
                    $div.append("Newbie");
                    addStar(1);
                }           
               
                function addStar(n){
                    for(i=n; i > 0 ; i--)
                        $div.append('<img src="http://aux2.iconpedia.net/uploads/404752226.png" width="10px" heigh="10px" alt="" />');
                }
               
            </then>
        </n.if.not.page_user.is_deactivated>
    </n.param_loop.>
</override_macro>
My test forum.