Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
305 views
in Themes by

Hello, How can I show different color for different user types's username?

For example, i want to show red color font for admin and green color for others.

Like this for admin -> sama55

for other usernames color like this-> muratdzeko

1 Answer

+2 votes
by

Relatively straightforward way is to override "qa_userids_handles_html ()" function in qa-include/app/users.php.

  1. Get user's level from DB with $handle parameter in the function
  2. Add class qa-user-link-[userlevel] to the user link HTML
  3. Add style "Admin" > "Layout" > "Custom HTML in <head> section of every page:"

This solution covers most, but not all. And, this solution will exacerbate site performance. So I will not recommend it.

Another way is to add $level argument to qa_userids_handles_html() function. And change the all of calling part of this function. This way you will need to change the core directly.

For example: 

function qa_get_one_user_html($handle, $microformats=false, $favorited=false, $level=null) {
...
}

...