Create A Forum - Support Forums

Support => Create a Forum Codes and Support => Topic started by: Agent Moose on August 06, 2010, 03:41:31 am

Title: [Code] Membergroup Image
Post by: Agent Moose on August 06, 2010, 03:41:31 am
This code utilizes jQuery, please use the latest version found in this thread: http://support.createaforum.com/5/jquery-v1-8-update/ (http://support.createaforum.com/5/jquery-v1-8-update/)

Footers:
Code: [Select]
<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>
Original Request: http://support.createaforum.com/create-a-forum-codes-and-support/runescape-crown-request/ (http://support.createaforum.com/create-a-forum-codes-and-support/runescape-crown-request/)

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)


Enjoy :)

EDIT:
Due to popular demand, I created a code that will add the crown (and whatever else you would like) to your username across the board!
http://support.createaforum.com/5/%28code%29-name-across-board/msg14864/#msg14864
Title: Re: [Code] Membergroup Image
Post by: Nick9 on August 06, 2010, 03:55:05 am
Very nice. I think that this is gonna come in handy. Thanks again, Moose. (:
Title: Re: [Code] Membergroup Image
Post by: Damien on August 06, 2010, 05:21:39 am
What do you add in header?
Title: Re: [Code] Membergroup Image
Post by: Agent Moose on August 06, 2010, 02:02:44 pm
Nope, add it to the footers :)
Title: Re: [Code] Membergroup Image
Post by: Nick9 on August 06, 2010, 03:08:43 pm
He's asking what he should add to the headers. It might be nothing, but we don't know...
Title: Re: [Code] Membergroup Image
Post by: Damien on August 06, 2010, 03:26:48 pm
What kind of Image can I use? A crown right?
Title: Re: [Code] Membergroup Image
Post by: Fate on August 06, 2010, 03:28:07 pm
Yes, or any image that you feel would fit nicely. :) You can always experiment until you find something to your liking.
Title: Re: [Code] Membergroup Image
Post by: Nick9 on August 06, 2010, 04:51:13 pm
Do you need to use the BBC image code inside the code??
Title: Re: [Code] Membergroup Image
Post by: Fate on August 06, 2010, 04:57:22 pm
No, simply replace "IMAGE" with the URL of the image you want to use.
Title: Re: [Code] Membergroup Image
Post by: Nick9 on August 06, 2010, 05:07:37 pm
Not working for me. :|
Title: Re: [Code] Membergroup Image
Post by: Fate on August 06, 2010, 05:43:33 pm
Make sure "Hide post group titles for grouped members" is set to on like Agent Moose mentioned.

Post the code you're using please. :)
Title: Re: [Code] Membergroup Image
Post by: Seldom Fail on August 06, 2010, 05:44:43 pm
Not working for me. :|

I think my mind reading ability is slowly fading... so you're gonna have to help me out by giving me a LITTLE more info ;) lol

1. Board URL
2. The code you tried.

Then we can help you :)
Title: Re: [Code] Membergroup Image
Post by: Nick9 on August 06, 2010, 05:52:18 pm
ruckascape.createaforum.com

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("Owner", "http://i766.photobucket.com/albums/xx305/Lion2126/OWNER1.gif");
GroupImage("In-Game Admin", "http://i734.photobucket.com/albums/ww344/Iomsscape/Mega%20Forum%20Images/admincrown-1.jpg");
GroupImage("Forum Admin", "http://i734.photobucket.com/albums/ww344/Iomsscape/Mega%20Forum%20Images/admincrown-1.jpg");
GroupImage("In-Game Mod", "http://i8.photobucket.com/albums/a38/StSquiggy/Runescape/ModCrown.png");
GroupImage("Forum Mod", "http://i756.photobucket.com/albums/xx204/shad0w_bucket/forumsstaffcrown.jpg");

</script>
Title: Re: [Code] Membergroup Image
Post by: Seldom Fail on August 06, 2010, 05:57:20 pm
I went to your forum and I can see the images.

Is it just for one group that it's not working? Or for all of them?
Title: Re: [Code] Membergroup Image
Post by: Fate on August 06, 2010, 06:06:08 pm
I tested the following code on my forums and it worked like a charm ;)

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("Owner", "http://i766.photobucket.com/albums/xx305/Lion2126/OWNER1.gif");
GroupImage("In-Game Admin", "http://i734.photobucket.com/albums/ww344/Iomsscape/Mega%20Forum%20Images/admincrown-1.jpg");
GroupImage("Forum Admin", "http://i734.photobucket.com/albums/ww344/Iomsscape/Mega%20Forum%20Images/admincrown-1.jpg");
GroupImage("In-Game Mod", "http://i8.photobucket.com/albums/a38/StSquiggy/Runescape/ModCrown.png");
GroupImage("Forum Mod", "http://i756.photobucket.com/albums/xx204/shad0w_bucket/forumsstaffcrown.jpg");
</script>

On your forum, I only see the image for Kane - since his membergroup is "Owner".
Make sure the "GROUP" MATCHES the membergroup name (Admin>Members>Membergroups).
Title: Re: [Code] Membergroup Image
Post by: Nick9 on August 06, 2010, 06:11:00 pm
Ok, it should only work for Kane. I guess I just didn't let the page load completely... He thinks I should be a "hidden" staff member... NOTE: this code only applies for your primary membergroup..
Title: Re: [Code] Membergroup Image
Post by: Agent Moose on August 07, 2010, 02:29:37 pm
From what I see, he only has it for the admins and mods, so it would only show for the primary group, since those are primary groups.
Title: Re: [Code] Membergroup Image
Post by: Nick9 on August 07, 2010, 04:12:49 pm
Yeah... Good thing it doesn't apply for hidden staff or it wouldn'tbe very hidden..
Title: Re: [Code] Membergroup Image
Post by: Damien on August 07, 2010, 04:13:01 pm
The forums has a member legend built in that i enable it. i like it.
thanks for this tho mate.
Title: Re: [Code] Membergroup Image
Post by: Thornton136 on August 07, 2010, 07:53:32 pm
thanks moose.


:)
Title: Re: [Code] Membergroup Image
Post by: Magrt on November 08, 2010, 02:40:18 am
Please where can i put this code in my forum help me.
Title: Re: [Code] Membergroup Image
Post by: Alex on November 08, 2010, 03:23:24 am
Please follow the directions in the first post of this topic. The code goes in the footers section of the forum. ;)
Title: Re: [Code] Membergroup Image
Post by: lizard king on March 04, 2012, 08:22:31 am
im trying to do this but it isnt working..
using his code:
and yes i followed all the directions.



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("Owner", "http://i766.photobucket.com/albums/xx305/Lion2126/OWNER1.gif");
</script>


can someone make a code for just single users and not groups?
thanks
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on March 04, 2012, 05:17:45 pm
It does work, you just gotta read the note:
Quote
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)

As for editing the code, I do not have permission to do that.
Title: Re: [Code] Membergroup Image
Post by: jie9 on March 13, 2012, 11:50:49 am
it's really hard to put codes if you are not that knowledgeable in formating codes but this codes are just to easy to put just to copy and paste will do.
Title: Re: [Code] Membergroup Image
Post by: Matt on April 20, 2012, 12:21:23 am
I need A code but I cant get can someone make it for me, GROUP"Administrator" IMAGE" http://i277.photobucket.com/albums/kk51/jssmiles/10qhzb8.png"
http://ascendancyx.createaforum.com/index.php-FORUMS
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on April 20, 2012, 03:21:39 am
The code is already in the first post with clear instructions.
Title: Re: [Code] Membergroup Image
Post by: Matt on April 20, 2012, 11:53:43 am
Everytime I try it's doesn't ork, please bro.
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on April 21, 2012, 01:24:36 am
1) Post the code that you tried to use.
2) Did you read the note in the first post?
3) What web browser and its version are you using?
Title: Re: [Code] Membergroup Image
Post by: Matt on April 21, 2012, 02:17:41 am
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js (https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.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.className === "membergroup" && PostGroup.innerHTML.toLowerCase() === Group.toLowerCase()){ $(PostGroup).parent().prev().find("a:last").prepend("<img src='" + Image + "' />"); }; if(PostGroup.className !== "membergroup" && PostGroup.className === "postgroup" && PostGroup.innerHTML.toLowerCase() === Group.toLowerCase()){ $(PostGroup).parent().prev().find("a:last").prepend("<img src='" + Image + "' />"); }; }; }; GroupImage("Administrator", " http://i277.photobucket.com/albums/kk51/jssmiles/10qhzb8.png (http://i277.photobucket.com/albums/kk51/jssmiles/10qhzb8.png) "); </script>

Yes, I did.
And the one before 2.0, ivthink idk.
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on April 21, 2012, 04:43:52 pm
When I compared the code you used with the original code, I noticed that you were missing a couple of things in there which would cause it to not work. Did you use any sort of compression tool on this code or something? I don't have any other explanation on how you missed some parts of the code unless you didn't copy and paste it.
Use this code instead:
Code: [Select]
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.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("Administrator", "http://i277.photobucket.com/albums/kk51/jssmiles/10qhzb8.png");
</script>

What exactly do you mean by "the one before 2.0"?
Title: Re: [Code] Membergroup Image
Post by: Matt on April 21, 2012, 06:04:09 pm
That code didnt work...so im guessing we have a dif version?
Title: Re: [Code] Membergroup Image
Post by: Matt on April 21, 2012, 06:08:12 pm
We never updated our forums so its the reg one, request another code.
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on April 21, 2012, 06:23:03 pm
I've just checked your forum right now and it DOES work. The problem is that you need to update your web browser to latest version available or get a new one.
Chrome:                              http://www.google.com/intl/en/chrome/
Firefox:                                http://www.mozilla.org/en-US/firefox/new/
IE9(Windows Vista/7 only): http://windows.microsoft.com/en-US/internet-explorer/downloads/ie-9/worldwide-languages
Title: Re: [Code] Membergroup Image
Post by: Matt on April 21, 2012, 06:40:17 pm
It matter?
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on April 21, 2012, 06:40:40 pm
Yes it actually does
Title: Re: [Code] Membergroup Image
Post by: Matt on April 21, 2012, 06:43:59 pm
So once i dl that firefox is should work ?
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on April 21, 2012, 06:44:43 pm
Yes, any of the 3 I listed above will work.
Title: Re: [Code] Membergroup Image
Post by: Matt on April 21, 2012, 06:48:03 pm
Once i dled do i go on that browser of firefox and re enter code?
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on April 21, 2012, 06:49:12 pm
You don't have to re-enter the code again, you will see the code work because the image will appear next to your name.
Title: Re: [Code] Membergroup Image
Post by: Matt on April 21, 2012, 06:52:45 pm
Thanks it worked.
Title: Re: [Code] Membergroup Image
Post by: Matt on April 21, 2012, 07:04:37 pm
How do i change the colour of name? I change the color in memeber group thinkingit would change it but it didnt
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on April 21, 2012, 07:06:29 pm
There isn't an option or a code for that yet.
Title: Re: [Code] Membergroup Image
Post by: halokiller38 on May 09, 2012, 03:04:36 am
How do I do this?
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on May 09, 2012, 01:34:21 pm
Instructions are already in the original post, if you be more specific then I can help you
Title: Re: [Code] Membergroup Image
Post by: halokiller38 on May 11, 2012, 02:42:55 am
Well.... let's see.... there aren't any instructions.
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on May 11, 2012, 10:02:54 pm
The whole post is the instructions with the exception of the original request link and the original poster saying enjoy with a emoticon....
Title: Re: [Code] Membergroup Image
Post by: RiloRii on May 16, 2012, 02:56:58 pm
^^; Okay, so everything worked up until I tried to add the last one.


On the last one, there wasn't anymore starfile ones. So I tried to do multiple other ones, but it just wouldn't work. :/ Is there any way to still do the last one? Or, for lack of a better phrase, am I just S.O.L? XD




Nevermind! (: I found a file that worked. <3
Title: Re: [Code] Membergroup Image
Post by: Tony on August 12, 2012, 11:37:16 pm
I know this is basically gravedigging but I really need help with this. I added the code
Code: [Select]
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.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("Administrator", "http://i277.photobucket.com/albums/kk51/jssmiles/10qhzb8.png");
</script>
to my footers and it didn't work. My web browser is updated too. My forum is http://divinpk.createaforum.com (http://divinpk.createaforum.com)
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on August 12, 2012, 11:57:35 pm
Did you read the note?
Title: Re: [Code] Membergroup Image
Post by: Tony on August 13, 2012, 12:01:38 am
Yeah
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on August 13, 2012, 12:13:14 am
I will take a look at this later
Title: Re: [Code] Membergroup Image
Post by: Tony on August 13, 2012, 12:25:04 am
Actually, I just realized the crown only shows when you post. I want the crown to be next to your name in Online Users, Recent Topics, everywhere.
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on August 13, 2012, 12:28:24 am
Ugh, this code wasn't designed for that
Title: Re: [Code] Membergroup Image
Post by: Tony on August 13, 2012, 05:26:09 am
Ugh, this code wasn't designed for that
Do you have a code designed for that?
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on August 13, 2012, 05:31:31 am
no
Title: Re: [Code] Membergroup Image
Post by: ipvpforum on October 28, 2012, 11:17:23 am
Hey can someone make it like that we can change color of nickname too?

And that the crown shows in online list too?

Like the code on smfforfree.com.


http://www.smfsupport.com/support/smf-for-free-codes-and-support/(code)-membergroup-color/ (http://www.smfsupport.com/support/smf-for-free-codes-and-support/(code)-membergroup-color/)
Title: Re: [Code] Membergroup Image
Post by: aIURbliS on November 04, 2012, 11:43:52 pm
Edited original post, now points to another topic for the latest version of jQuery.
Title: Re: [Code] Membergroup Image
Post by: CyanProductions on November 11, 2014, 08:57:48 pm
Is there a way I can alter it so it displays the image on the online list?
Title: Re: [Code] Membergroup Image
Post by: SomeHandsomeGuy on November 17, 2014, 08:05:03 pm
Cool, added the code, only to pick what pic to add. Maybe a crown or something. Any suggestions?
Title: Re: [Code] Membergroup Image
Post by: Agent Moose on November 27, 2014, 04:24:38 am
Tony, ipvpforum and CyanProductions, your request has been filled! :D  I'm surprised I never made a code like taht for this forum.

http://support.createaforum.com/5/%28code%29-name-across-board/msg14864/#msg14864