The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Username in color problem

2 posters

Go down

Solved Username in color problem

Post by BlackScorpion August 23rd 2014, 4:00 am

This was working fine until i touched something in the group management panel, went back and redid it over and it still does not work.  

https://help.forumotion.com/t129844-username-in-multiple-colors

Now it doesn't work, were their any changes made to the Javascript or the editor that could have changed something and make it stop working?

this is the script i'm using:

$(function(){
$('a[href="/uXXX]').not(function(){return $("img",this)[0]}).html('<strong><font color="#000000">Go</font><font color="#ff9600">Power</font><font color="#0000">Sports</font></strong>');
});

http://gokartbazaar.com

Thanks


Last edited by BlackScorpion on August 24th 2014, 3:32 am; edited 1 time in total
BlackScorpion
BlackScorpion
Graphic Designer
Graphic Designer

Male Posts : 7009
Reputation : 919
Language : English
Location : USA

https://help.forumotion.com/f6-graphic-design-section

Back to top Go down

Solved Re: Username in color problem

Post by Ange Tuteur August 23rd 2014, 5:43 am

Hi BlackScorpion,

From the code it looks like you're missing a double quote in a[href=""]. I made it more simple to edit though. Smile

Write : multiColor(id, html);

id : The user id of the member you wish to modify
html : The replacement HTML

Here is the code with one setup :
Code:
$(function(){
  multiColor(733, '<strong><font color="#000000">Go</font><font color="#ff9600">Power</font><font color="#0000">Sports</font></strong>'); // member username
  
  function multiColor(id, html){$('a[href="/u'+id+'"]').not(function(){return $("img",this)[0]}).html(html)}
});
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Username in color problem

Post by BlackScorpion August 24th 2014, 2:58 am

this would replace the current javascript, correct? I would enter the members id here [href="/u'+id+'"] such as [href="/u'+u1+'"]

S can you provide me an example say for me "BlackScorpion ID u1"
thanks for the help Ange
BlackScorpion
BlackScorpion
Graphic Designer
Graphic Designer

Male Posts : 7009
Reputation : 919
Language : English
Location : USA

https://help.forumotion.com/f6-graphic-design-section

Back to top Go down

Solved Re: Username in color problem

Post by Ange Tuteur August 24th 2014, 3:13 am

Yep, it'll replace your current script.  +id+ is data passed through the multiColor() function.

So it's more simple and takes less space up, you can just copy and paste :
Code:
multiColor(733, '<strong><font color="#000000">Go</font><font color="#ff9600">Power</font><font color="#0000">Sports</font></strong>');

After the first multicolored username, to color another user. Just fill out the fields :

733 => new user id
old html => new html

Here, I added you as the first color :
Code:
$(function(){
 multiColor(1, '<strong><font color="#000000">Black</font><font color="#ff9600">Scorpion</font></strong>'); // BlackScorpion
 multiColor(733, '<strong><font color="#000000">Go</font><font color="#ff9600">Power</font><font color="#0000">Sports</font></strong>'); // GoPowerSports
 
 function multiColor(id, html){$('a[href="/u'+id+'"]').not(function(){return $("img",this)[0]}).html(html)}
});
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Username in color problem

Post by BlackScorpion August 24th 2014, 3:31 am

Got it now much easier.. Thanks Your the best. Now maybe you can update the tutorial Wink . Just kidding!
BlackScorpion
BlackScorpion
Graphic Designer
Graphic Designer

Male Posts : 7009
Reputation : 919
Language : English
Location : USA

https://help.forumotion.com/f6-graphic-design-section

Back to top Go down

Solved Re: Username in color problem

Post by Ange Tuteur August 24th 2014, 3:37 am

You're welcome BlackScorpion. Smile

Topic archived

You are right, I'll most likely update the tuto with this code since it is easier. Wink
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum