Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
675 views
in Plugins by
closed by

Hello!
I have a question about Plugin
Is there a plugin that colors the nicknames ? For example, as the topic speaks admin , his nickname is underlined in red.
Sorry for my English
I look forward to your prompt reply
Regards

Q2A version: 1.7.3
closed with the note: .

1 Answer

+2 votes
by
selected by
 
Best answer

I don't know of any existing plugin, but this should be possible in a custom theme, or a layer plugin.

Override a function such as post_meta_who, then check the user type against the constants from qa-include/app/users.php, and change the colour accordingly.

See http://docs.question2answer.org for more details on writing plugins.


Here's an example overriding the post_meta_who function:

public function post_meta_who($post, $class)
{
    $class = '';

    switch ($post['raw']['level']) {
        case QA_USER_LEVEL_SUPER:
        case QA_USER_LEVEL_ADMIN:
            $class = 'usertype-admin';
            break;
    }

    $post['who']['data'] = '<span class="' . $class . '">' . $post['who']['data'] . '</span>';
    parent::post_meta_who($post, $class);
}

You'll need to expand the different cases in the switch for each user type (see the constants defined at the top of qa-include/app/users.php).

by
It does not work :(
by
Where do I paste?
by
What exactly doesn't work?

The code needs to go either in a custom layer plugin, or a custom theme. For a theme it goes in the file qa-theme.php, inside the class.
by
Do not work for me coloring that is a class defined by me, but this class " message " A style tag
...