1

I am making a custom Wordpress site where School students logged in and add their posts. I am giving them rights to use wp-admin panel with little customization and modification.

QUESTION: "How can logged in user be able to see comments of his own post only in edit comment admin panel"

please suggest me some solution i am in need for the same

Thanks in advance

0

i had been looking for the code where logged in users will be able to see post of his own only i have managed to make simple function that we can use for the same the function snippet has to be included in functions .php file in the theme folder which you are using

function my_plugin_get_comment_list_by_user($clauses) 

{

if (is_admin()) 

{

  global $user_ID, $wpdb;

  $clauses['join'] = ", wp_posts";

  $clauses['where'] .= " AND wp_posts.post_author = ".$user_ID." AND wp_comments.comment_post_ID = wp_posts.ID";

 };

 return $clauses;

}

// Ensure that editors and admins can moderate all comments

if(!current_user_can('edit_others_posts')) 

{

 add_filter('comments_clauses', 'my_plugin_get_comment_list_by_user');

}

Thanks NIkhil Joshi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.