Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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