i am trying to show wordpress registered users role like – subscriber, author, editor etc.
into comment page of wordpress.
for that i created this code
<?php //get the commented user id
$user_id = get_comment(get_comment_ID())->user_id;
if ($user_id)
{
$user_info = get_userdata($user_id );
echo implode(', ', $user_info->roles) ;
} ?>
it is working fine for me
If commentator’s name is KING KHAN and he is subscriber then it shows
KING KHAN [subscriber]
but if the user is being deleted then into the comment page in comment of that user it shows
KING KHAN[ Warning: implode(): Invalid arguments passed in /home/USERACCOUNT/public_html/wp-includes/class-walker-comment.php on line 277]
Here instead of this i want to show
KING KHAN[Member Deleted]
please edit above code for this
You need to use condition as I did on following code.