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
Changng output text...
 
Notifications
Clear all

[Solved] Changng output text for disabled coments for user (global) and single user

9 Posts
2 Users
1 Reactions
1,424 Views
(@orakel)
Posts: 107
Estimable 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
 
[#1210]

Hello all, hello dear Asti

 

Some Weeks ago, you helped me to show a textline above the comment section, if comments are disabled,

 


add_action("wpdiscuz_comment_form_closed", function ($post, $currentUser, $commentsCount) {
echo "Comments are deactivated in this article";
}, 10, 3)

 

Yesterday i got it to work, to disable the comment form for a specific (comment banned) user.

It´s this lines if anyone like it:

 

just make a new role with only "read" permission, example name = locked)

add_filter( 'init', function()
{
$u = wp_get_current_user();

if( $u->exists() && in_array( 'locked', $u->roles, true ) )
add_filter( 'comments_open', '__return_false' );
} );

 

My question now is, how i get it to work to show different messages if its a post related comment close like the code at first (Comments are deactivated in this article) or a userrole related message like "You are not allowed to post comments".

Is it possible to include the second message with a if else code like if userrole = banned shwow this, if not show this, in that codelines?

add_action("wpdiscuz_comment_form_closed", function ($post, $currentUser, $commentsCount) {
echo "Comments are deactivated in this article";
If userrole = banned echo "you are locked and not possible to write a comment"
}, 10, 3)

 

further i was searchng for the css class (ok i am a realy new on css bt learning fast)

how can i format this text inside the php echo?

 

Thanks in adcance

Orakel


 
Posted : 17/10/2020 2:21 am
Asti
 Asti
(@asti)
Posts: 8267
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
 

@orakel,

You should use the hook provided by us and add custom code for either displaying the first message or the second one.

how can i format this text inside the php echo?

You can add your custom HTML codes with some classes, then apply the CSS rules for those classes.


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 : 17/10/2020 3:18 pm
Orakel reacted
(@orakel)
Posts: 107
Estimable 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
 

Hello dear Asti

 

I know the problem with the different messages are not wpdiscuz related, but you are so very helpfull in all.

I am not a good coder but i try to learn. Would it be ok for you to give me an example how i can get this different messages?

 

Thanks in advance

Orakel


 
Posted : 17/10/2020 4:19 pm
(@orakel)
Posts: 107
Estimable 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
 
Posted by: @orakel

echo "Comments are deactivated in this article";

Can you explain how i define a class into the echo command?

 

Orakel


 
Posted : 17/10/2020 6:07 pm
(@orakel)
Posts: 107
Estimable 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
 

got it to work with the formating text and own css style ^^

 

image

 
Posted : 18/10/2020 9:53 am
Asti
 Asti
(@asti)
Posts: 8267
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
 

@orakel,

So, can we mark this topic as solved? 


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 : 19/10/2020 11:56 am
(@orakel)
Posts: 107
Estimable 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
 

Hello Asti

 

If you can, i would still need help, with the different messages :/

 

Orakel


 
Posted : 19/10/2020 8:45 pm
Asti
 Asti
(@asti)
Posts: 8267
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
 

@orakel,

use this code:

add_action("wpdiscuz_comment_form_closed", function ($post, $currentUser, $commentsCount) {
if (!empty($currentUser->ID) && in_array("banned", $currentUser->roles)) {
echo "you are locked and not possible to write a comment";
} else {
echo "Comments are deactivated in this article";
}
}, 10, 3);

Put it in the 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 : 21/10/2020 12:12 pm
(@orakel)
Posts: 107
Estimable 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
 

Hello Asti

 

This works great, thank you very much =)

 

Orakel


 
Posted : 21/10/2020 7:00 pm