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
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.
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
echo "Comments are deactivated in this article";
Can you explain how i define a class into the echo command?
Orakel
Hello Asti
If you can, i would still need help, with the different messages :/
Orakel
Hello Asti
This works great, thank you very much =)
Orakel