Arcadia Power

Author Topic: [CODE] Membergroup Image-- Agent Moose  (Read 960 times)

Nick

  • Global Moderator
  • *
  • Posts: 23
  • Reputation: -1
    • View Profile
[CODE] Membergroup Image-- Agent Moose
« on: August 05, 2010, 11:06:44 pm »
100% of the credit for making this code goes to Agent Moose

Code: [Select]
<script type="text/javascript" src="http://smcodes.smfforfree3.com/jquery.js"></script>
<script type="text/javascript">
function GroupImage(Group, Image){
//Created by Agent Moose
var PostGroup = document.getElementsByTagName("li");
for(x=0;x<PostGroup.length;x++){
if(PostGroup[x].className === "membergroup" && PostGroup[x].innerHTML.toLowerCase() === Group.toLowerCase()){
$(PostGroup[x]).parent().prev().find("a:last").prepend("<img src='" + Image + "' />");
};
if(PostGroup[x].className !== "membergroup" && PostGroup[x].className === "postgroup" && PostGroup[x].innerHTML.toLowerCase() === Group.toLowerCase()){
$(PostGroup[x]).parent().prev().find("a:last").prepend("<img src='" + Image + "' />");
};
};
};
GroupImage("GROUP", "IMAGE");
</script>

GROUP = The Group for which the selected image will show next to their names in posts.
IMAGE = the Image for the group you have selected.

To Add more images for certain membergroups, add more of these lines:

Code: [Select]
GroupImage("GROUP", "IMAGE");

NOTE:
The only way this code will work is if you remove "Post Group" title for Admins/Mods:
    Admin-> Layout Settings-> Theme Settings-> Turn "Hide post group titles for grouped members" to on. (section two-subsection four-option six)

100% of the credit to making this code goes to Agent Moose

Share on Facebook Share on Twitter