vForums Support > Programming & Coding :: Code Requests & Support :: > Groups and Ranks

Groups and Ranks - Posted By Aiken (ionfortuna) on 23rd Sep 08 at 2:49pm
Something that will show a memberss rank below the group if none of the member's groups are staff groups.

Re: Groups and Ranks - Posted By ashkir (ashkir) on 23rd Sep 08 at 5:10pm
Wouldn't a thread or something in the general rules / information be good for the rank listing and posts required?

Re: Groups and Ranks - Posted By Aiken (ionfortuna) on 23rd Sep 08 at 5:50pm
Not a listing of the ranks but if a member is in a group I want a code that will also show their rank.

Re: Groups and Ranks - Posted By Aiken (ionfortuna) on 25th Sep 08 at 3:53pm
bump

Re: Groups and Ranks - Posted By dog199200 (dog199200) on 26th Sep 08 at 1:41am
ah ok, so meaning you wnat it to show the ranks even if the member is in group? If so then I have the code you need on one of my forums, i'll just have to fish it out for you

Re: Groups and Ranks - Posted By Aiken (ionfortuna) on 27th Sep 08 at 11:30am
Thanks, that is what I want...

Re: Groups and Ranks - Posted By dog199200 (dog199200) on 27th Sep 08 at 7:26pm
OK i think mine has been modified a bit from the original version that could of been found on PBS, so if it doesnt work please let me know.

Mini Profile Template Portion:
Code:
 
  1. <script type="text/javascript">
  2. assign_rank('{display_name}', '{posts}');
  3. </script>
  4.  
 


Put it just under the original (rank) command and it should work fine.


Global Header Portion:
Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. var ranks = Array(); var r=0;
  4.  
  5. ranks[r++] = Array(0, 'Rank 1 Name', Rank 1 Image Amount, 'Rank 1 Image URL');
  6. ranks[r++] = Array(0, 'Rank 2 Name', Rank 2 Image Amount, 'Rank 2 Image URL');
  7. ranks[r++] = Array(0, 'Rank 3 Name', Rank 3 Image Amount, 'Rank 3 Image URL');
  8.  
  9. function assign_rank(display_name, posts) {
  10. if(!display_name.match(/group0/i)) {
  11. posts = parseInt(posts.replace(/,/g, ''));
  12. r = 0;
  13. while(ranks[r] && ranks[r][0] < posts) {
  14. r++;
  15. }
  16. if(r > 0)
  17. r--;
  18. var rank_str = "" + ranks[r][1] + "<br />";
  19. for(c=0; c<ranks[r][2]; c++) {
  20. rank_str += "<img src=\""+ ranks[r][3] +"\" alt=\"*\" />";
  21. }
  22. document.write(rank_str);
  23. }
  24. }
  25. //-->
  26. </script>
 

[/code]


To add more ranks to it, please just repeat this:

Code:
 
  1. ranks[r++] = Array(0, 'Rank Name', Rank Image Amount, 'Rank Image URL');
 



OK now I you have any problems please feel free to post back and i'll do my best to help you out. I'm not sure how your system is setup, but this code should work either way.

Re: Groups and Ranks - Posted By Aiken (ionfortuna) on 28th Sep 08 at 10:23pm
Yep, it works!! {Grin}

Re: Groups and Ranks - Posted By dog199200 (dog199200) on 29th Sep 08 at 1:06am
{Smile} glad to hear it