(former) (new problem) Avatar missing in member list (code issue) 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.
3 posters

    (former) (new problem) Avatar missing in member list (code issue)

    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 15th 2015, 7:20 am

    [Former issue: Individual Username Colors: Status: solved]

    [New Issue: code issue removing avatar from memberlist due to username color code]

    [defunct: I was wondering if it was possible to edit individual usernames by coloring them without adding them to a group. 

    If there's some sort of code or something, please let me know. Smile ]




    [edit] With the help of some friendly people, I have figured out how to change individual user-name colors but, in applying the respected code to the forum, it has removed the avatar from my memberlist.

    This is not particularly urgent as I could easily remove the code but I choose not to as I'm using a test forum. 

    If any of you know a "fix" for this it would be greatly appreciated. Smile



    Last edited by Global Federation on July 23rd 2015, 7:55 am; edited 1 time in total
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 15th 2015, 7:36 am

    Anyone going to deal with the ad-bot?
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Ange Tuteur July 15th 2015, 12:21 pm

    Hi @Global Federation,

    You can find an answer in this topic, or this one.

    If none of those match what you're looking for, just let me know.

    Global Federation wrote:Anyone going to deal with the ad-bot?
    When ever a staff member is online they will ban the bots. However, only certain members can moderate a section, so sometimes they need to wait until a member gets on who can move the spam elsewhere. If you feel the need, you can report the post to staff.
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 15th 2015, 5:40 pm

    Alright, will do! Smile

    Code:
    $(function() {
      var users = {
        'u1' : '<span style="color:red">MY</span> <span style="color:blue">NAME</span>',
        'u2' : '<span style="color:purple">ANOTHER</span> <span style="color:pink">NAME</span>'
      },
      a = document.getElementsByTagName('A'), i = 0, j = a.length, k;
      
      for (; i<j; i++) for (k in users) $(a[i]).attr('href') == ('/' + k).toLowerCase() && (a[i].innerHTML = users[k]);
    });

    I'm wondering however if this could be used to color just one username and if this will affect group coloring in anyway or vice versa.
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Ange Tuteur July 16th 2015, 9:55 am

    Yes, it can be used for one name as long as you only include one property in the object. ( e.g. keep u1's line and remove u2's line. )

    Code:
    $(function() {
      var users = {
        'u1' : '<span style="color:red">MY</span> <span style="color:blue">NAME</span>'
      },
      a = document.getElementsByTagName('A'), i = 0, j = a.length, k;
     
      for (; i<j; i++) for (k in users) $(a[i]).attr('href') == ('/' + k).toLowerCase() && (a[i].innerHTML = users[k]);
    });

    It will affect group coloring as once the script finds an element that matches the conditions it will overwrite that element's HTML with the HTML you specified. The element in question is a link which matches your user id.
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 20th 2015, 5:11 am

    Where would I place it?

    And would I have to update this every-time someone changes their username?
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Pizza Boi July 20th 2015, 5:40 am

    Hi Very Happy

    You would have to place them in Javascript Management < In all pages.

    And yes, unfortunately you have to change, else the name appearing won't appear the same to the one they changed it.

    Regards,
    Pizza Boi
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 20th 2015, 5:33 pm

    Thank you guys for all your help, however, I'm having trouble setting it up, could you show me how the fields have to be filled?

    [edit] I'm sorry I couldn't thank two people. I was seeing if I could.
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Pizza Boi July 20th 2015, 7:03 pm

    Hi Very Happy

    Something like this: http://prntscr.com/7uwkie

    Regards,
    Pizza Boi
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 21st 2015, 6:14 am

    Thank you, but I meant the fields within the script. I'm not one for knowledge based on code. xD
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Pizza Boi July 21st 2015, 7:01 am

    Hi Very Happy

    I marked them in red boxes Smile http://prntscr.com/7v4dmx

    You can change the u1 to any username value and the other box with style. See how My has a </span> after? It means that you can start changing the 2nd name when the second <span> starts. As for <span style="color: red;">, you can change red to any hexadecimal value for the colors (You can google the values).

    Regards,
    Pizza Boi
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 21st 2015, 7:21 am

    Code:
    $(function() {
      var users = {
        'Saleena' : '<span style="color:red">Saleena</span>'
      },
      a = document.getElementsByTagName('A'), i = 0, j = a.length, k;
      
      for (; i<j; i++) for (k in users) $(a[i]).attr('href') == ('/' + k).toLowerCase() && (a[i].innerHTML = users[k]);
    });

    Am I doing this right or do I have to have the second span bracket for it to work. I'm trying to influence one username.
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Pizza Boi July 21st 2015, 7:29 am

    Hi Very Happy

    You have to re-write it as this:

    Code:
    $(function() {
      var users = {
        '/u# of Saleena' : '<span style="color:red">Saleena</span>'
      },
      a = document.getElementsByTagName('A'), i = 0, j = a.length, k;
     
      for (; i<j; i++) for (k in users) $(a[i]).attr('href') == ('/' + k).toLowerCase() && (a[i].innerHTML = users[k]);
    });

    As for the one <span> tag, that's okay. Also, see this: /u# of Saleena. You have to change that to Saleena's user #. You can find out by clicking the user's profile and check your address bar for this: http://prntscr.com/7v4k9p

    Regards,
    Pizza Boi
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 21st 2015, 7:40 am

    Code:
    $(function() {
      var users = {
        '/u6' : '<span style="color:red">Saleena</span>'
      },
      a = document.getElementsByTagName('A'), i = 0, j = a.length, k;
      
      for (; i<j; i++) for (k in users) $(a[i]).attr('href') == ('/' + k).toLowerCase() && (a[i].innerHTML = users[k]);
    });

    Okay, do i have to have "u6" like it is? I've tried multiple variations and nothing so far has worked.
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Pizza Boi July 21st 2015, 7:53 am

    Hi Very Happy

    Oh sorry, remove / from it. My apologies; however it should work now.

    Regards,
    Pizza Boi
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 21st 2015, 8:01 am

    Thank you so much, it worked, however it removed the avatar from my memberlist.
    Pizza Boi
    Pizza Boi
    Hyperactive


    Male Posts : 2016
    Reputation : 160
    Language : French
    Location : Pizza Hut!

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Pizza Boi July 21st 2015, 8:17 am

    Hi Very Happy

    o.O" oh wow... I apologize but I know nothing of that now.

    Regards,
    Pizza Boi
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 21st 2015, 8:37 am

    Hmm, alright, thanks much! Smile

    Hopefully someone will come around who does.
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 23rd 2015, 7:56 am

    My first post now explains my problem if anyone of you is able to help. Smile
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation July 28th 2015, 5:36 pm

    5-day bump.
    Global Federation
    Global Federation
    Forumember


    Posts : 74
    Reputation : 1
    Language : English

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Global Federation August 4th 2015, 6:54 pm

    Bump
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    In progress Re: (former) (new problem) Avatar missing in member list (code issue)

    Post by Ange Tuteur August 4th 2015, 7:09 pm

    Hi @Global Federation,

    I apologize for the late reply, but see if this works for you :
    Code:
    $(function() {
      var users = {
        'u6' : '<span style="color:red">Saleena</span>'
      },
      a = document.getElementsByTagName('A'), i = 0, j = a.length, k, img;
     
      for (; i<j; i++) {
        for (k in users) {
         
          if ($(a[i]).attr('href') == ('/' + k).toLowerCase()) {
            img = null;
           
            if (a[i].getElementsByTagName('IMG')[0]) {
              img = document.createElement('IMG');
              img.src = a[i].getElementsByTagName('IMG')[0].src;
            }
           
            a[i].innerHTML = users[k];
            img && a[i].insertBefore(img, a[i].firstChild);
          }
       
        }
      }
    });

    Just replace your currently existing script.