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.

Welcome code problem

2 posters

Go down

Solved Welcome code problem

Post by Ape January 10th 2016, 8:21 am

Hello all.

I have been making a widget on my forum and wanted the Username in this Code to change when the member logs in
I have got it to work but the color of the text don't match there username to the groups there in it just comes out Black

 

Code:
<div id="LGstatus1">
                                                           
    <div align="center">
                            <span style="color: rgb(102, 102, 255);"><span style="font-family: FontAwesome;"><span style="font-size: 18px; line-height: normal"> </span></span></span><strong><span style="color: #000000;"><span style="font-size: 13px;">Welcome To your Control Panel <span style="color: #ff0000;">        {USERNAME}</span></span></span> </strong>                   
    </div>

What I want is when Say Gizmo logs in the username will be red like he is in the Admin Group and say Fish Crazy logs in it will show he;s name in the Green Mods color Group

can some one tell me how to make this work so when anyone logs in there name will change to the group color's

Much thanks to anyone that can help Wink

APE


Welcome code problem Left1212Welcome code problem Center11Welcome code problem Right112
Welcome code problem Ape_b110
Welcome code problem Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19325
Reputation : 2005
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Welcome code problem

Post by 10spetter10 January 10th 2016, 10:33 am

Try adding this script. It should search for the username in the 'Registered Users' list at the bottom of the index, and take the color of it to the element with id 'usernameIndexMessage'.

Code:
$(function() {
  var usernameColor = $('#fa_online_users span:contains('+_userdata.username+')').css('color');
  $('#usernameIndexMessage').css('color',usernameColor);
});

So then you need to make sure there is an element with id 'usernameIndexMessage' in here, I added the id to the span around the username:

Code:
<div id="LGstatus1">
                                                         
    <div align="center">
                            <span style="color: rgb(102, 102, 255);"><span style="font-family: FontAwesome;"><span style="font-size: 18px; line-height: normal"> </span></span></span><strong><span style="color: #000000;"><span style="font-size: 13px;">Welcome To your Control Panel <span id="usernameIndexMessage" style="color: #ff0000;">        {USERNAME}</span></span></span> </strong>                 
    </div>
10spetter10
10spetter10
Forumember

Posts : 195
Reputation : 82
Language : Dutch

Back to top Go down

Solved Re: Welcome code problem

Post by Ape January 10th 2016, 10:46 am

That worked like a charm thank you @10spetter10 +1 Wink


Welcome code problem Left1212Welcome code problem Center11Welcome code problem Right112
Welcome code problem Ape_b110
Welcome code problem Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19325
Reputation : 2005
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Welcome code problem

Post by Ape January 10th 2016, 11:27 am

Topic solved and archived


Welcome code problem Left1212Welcome code problem Center11Welcome code problem Right112
Welcome code problem Ape_b110
Welcome code problem Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19325
Reputation : 2005
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Back to top

- Similar topics

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