Welcome code problem Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
2 posters

    Welcome code problem

    Ape
    Ape
    Administrator
    Administrator


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

    Solved Welcome code problem

    Post by Ape Sun 10 Jan - 8:21

    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
    10spetter10
    10spetter10
    Forumember


    Posts : 195
    Reputation : 82
    Language : Dutch

    Solved Re: Welcome code problem

    Post by 10spetter10 Sun 10 Jan - 10:33

    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>
    Ape
    Ape
    Administrator
    Administrator


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

    Solved Re: Welcome code problem

    Post by Ape Sun 10 Jan - 10:46

    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

    Solved Re: Welcome code problem

    Post by Ape Sun 10 Jan - 11:27

    Topic solved and archived



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