The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
AI Assistant
Icon after register...
 
Notifications
Clear all

Question [Solved] Icon after registered user

3 Posts
2 Users
0 Reactions
972 Views
Posts: 4
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@gitarrenbog)
Active Member
Joined: 2 years ago
[#8490]

Hello,
is it possible to insert a small icon / image after the username for a specific role (registered user)?
I can change the CSS file, but I can't find where the query for the different roles is.
Thanks for the help.
Stefan


2 Replies
Asti
Posts: 8284
 Asti
Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@asti)
Illustrious Member
Joined: 8 years ago

Hi,

You can use the hook code below: 

add_filter("wpdiscuz_after_comment_author", function ($html, $comment, $user) {
    if (!empty($user->ID) && !empty($user->roles) && is_array($user->roles)) {

        if (in_array('author', $user->roles)) { // if user has the role : author
            $html .= ' <img src="https://www.svgrepo.com/show/13644/avatar.svg" width="18" height="18" />';
        } else if (in_array('editor', $user->roles)) { // if user has the role : editor

        }
        // and so on..
    }
    return $html;
}, 10, 3)

Please note it's just an example you should customize it. 


Posts: 4
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@gitarrenbog)
Active Member
Joined: 2 years ago

Great! Thank you!