• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Colors for Admins

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
1 post • Page 1 of 1

Colors for Admins

Postby rrasco » Tue Feb 05, 2013 6:29 pm

I am trying to get the admin names to appear red and other users to be a dark grey. I was able to achieve this in the nick list by modifying buildNickItem_modify_nick_style :

Code: Select all
  buildNickItem_modify_nick_style: function(nickid, span)
  {
      // this method can be overloaded to change the nick style (color, font ...)
      // example: span.style.color = 'red';
      var isadmin = this.getUserMeta(nickid, 'isadmin');
      if (isadmin == '') isadmin = false;
      if (isadmin == true) span.style.color = "#CC0000";
        else span.style.color = "#888888";
  }


I could easily call this same function for the pfc_nick and/or the pfc_nickmarker spans, but when those elements are created, I do not have a nickid to pass to them, allowing me to check if the user isadmin or not. I currently have this working, but I had to hardcode in the admin names.

Code: Select all
  colorizeNicks: function(root)
  {
    if (this.nickmarker)
    {
      var nicklist = this.getElementsByClassName(root, 'pfc_nickmarker', '');
      for(var i = 0; i < nicklist.length; i++)
      {         
        var cur_nick = nicklist[i].innerHTML;       
        if(cur_nick == "admin1" || cur_nick == "admin2") {
            var cur_color = "#CC0000";
        } else {
            var cur_color = "#888888";
        }
        //var cur_color = this.getAndAssignNickColor(cur_nick);
        nicklist[i].style.color = cur_color;
      }
    }
  }


I would like to use isadmin to determine if the user is an admin or not. Are there any easy methods to accomplish this? If I could figure out how to transports nickid to colorNicks() I could easily make the change. I have scoured the FAQ and forums looking for some leads, but nothing yet.
rrasco
New member
 
Posts: 1
Joined: Tue Feb 05, 2013 6:18 pm
Top

Post a reply
1 post • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: Google [Bot] and 3 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub