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


