The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
if comment author i...
 
Notifications
Clear all

[Solved] if comment author is admin add role class to "wpd-comment-wrap"

5 Posts
2 Users
0 Reactions
1,747 Views
(@inumedia)
Posts: 2
New Member
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
 
[#4578]

Hello

If the administrator comment his own post, it's displaying in "author" color in the template, so I wish to replace "wpd-blog-post_author" by "wpd-blog-administrator", for this specific case.

Any function to do it ? 

May be by doing something in Jquery based on the "wpd-tooltip" value ? 
But I don't know how doing this.

 

thanks


 
Posted : 11/07/2022 4:52 pm
Asti
 Asti
(@asti)
Posts: 8259
Illustrious Member 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
 

@inumedia,

If you want to replace the "Author" label with "Administrator" you can use the hook code below:

add_filter("wpdiscuz_author_title", function ($label, $comment) {
    global $post;
    if ($comment->user_id == $post->post_author) {
        $label = __("Administrator", "wpdiscuz");
    }
    return $label;
}, 10, 2);

Put the hook code in the WordPress active theme functions.php file. Helpful article: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 12/07/2022 11:23 am
(@inumedia)
Posts: 2
New Member
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
 

Hi 

yes I already did that but the color behind stay as "author" color not as "administrator".

So i'm trying a hook to add the wpd-blog-administrator class if the label is equal to "Administrator"


 
Posted : 12/07/2022 11:28 am
Asti
 Asti
(@asti)
Posts: 8259
Illustrious Member 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
 

@inumedia,

Please remove the code provided in the previous post and add this one: 

add_filter("wpdiscuz_author_title", function ($label, $comment) {
    global $post;
	$user = get_user_by('id', $comment->user_id);
    if ($comment->user_id == $post->post_author && is_array($user->roles) && in_array("administrator",$user->roles)) {
        $label = __("Administrator", "wpdiscuz");
    }
    return $label;
}, 10, 2);

Regarding the colour of the label, you'll be able to change it using custom CSS code with the next version of the wpDiscuz plugin (no ETA). Currently, there is no way to change the colour even with the js code. 


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 12/07/2022 6:12 pm
Asti
 Asti
(@asti)
Posts: 8259
Illustrious Member 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
 

@inumedia,

The new version is ready. 


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 29/07/2022 11:46 am