The effects of alcohol on
sustanon 250 leucine for – real weight loss & bodybuilding benefits?
[Solved] how to display some phrases when comment section is hidden.
✦ Summarize Topic
✦
✦
✦
AI is analyzing the discussion...
How-to and Troubleshooting
(@lightlaw)
Posts: 5
Active 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
Show original
Translating...
[#7887]
I've set Comment Form Settings to hide comment section for user roles, and it works fine.
But, I want to display something like below in that hidden section :
"You are not allowed to see the comments."
How can I do it?
Posted : 30/01/2024 4:53 am
(@asti)
Posts: 8257
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
Show original
Translating...
Hi,
You can use the wpdiscuz_before_comments hook and display messsage. Just check if the current user has permission to view comments.
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 : 31/01/2024 1:47 pm
(@lightlaw)
Posts: 5
Active 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
Show original
Translating...
Thank you Asti.
Where should I insert the wpdiscuz_before_comments hook?
Please understand that I am a beginner in coding.
Posted : 02/02/2024 5:33 am
(@asti)
Posts: 8257
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
Show original
Translating...
@lightlaw,
In your currently active theme functions.php file.
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 : 02/02/2024 6:26 pm
(@lightlaw)
Posts: 5
Active 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
Show original
Translating...
@asti Thanks, but custom messages are displayed not only to unpermitted users, but also to permitted users. I want to display custom messages only to unpermitted users.
Posted : 06/02/2024 6:56 am
(@asti)
Posts: 8257
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
Show original
Translating...
@lightlaw,
Just check if the current user has permission to view comments.
The provided code is just an example. You should customize it to suit your needs and ensure it functions as desired.
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 : 06/02/2024 2:43 pm
(@lightlaw)
Posts: 5
Active 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
Show original
Translating...
@asti Thank you. I solved it by adding the following code.
add_action("wpdiscuz_before_comments", function ($post, $currentUser, $commentsCount) {
$user = wp_get_current_user();
$user_roles = $user->roles;
if (in_array(‘role01', $user_roles) || in_array(‘role02', $user_roles)) {
echo "Custom Message";
}
}, 10, 3);
Posted : 08/02/2024 5:39 am
Super Globals
Options and Features