Check If comment author is registered

I wonder if you mean this kind of check: if( $comment->user_id > 0 ) { // Registered comment author } in your comment’s template callback. This is determined in the the wp-comments-post.php file: $commentdata = compact(‘comment_post_ID’, …, ‘user_ID’ ); $comment_id = wp_new_comment( $commentdata ); but it’s not obvious where the user_ID variable comes from, since … Read more

Modify column_author in WP_Comments_List_Table

This is how the email part is displayed by the WP_Comments_List::column_author() method: /* This filter is documented in wp-includes/comment-template.php */ $email = apply_filters( ‘comment_email’, $comment->comment_author_email, $comment ); if ( ! empty( $email ) && ‘@’ !== $email ) { printf( ‘<a href=”https://wordpress.stackexchange.com/questions/258903/%1$s”>%2$s</a><br />’, esc_url( ‘mailto:’ . $email ), esc_html( $email ) ); } so you’re … Read more

What should I do to make generated avatars different for anonymous comments?

There are two ways to customize the default avatar: Add a new default avatar to Settings/Discussion. Change the output of get_avatar(). Let’s start with the first option; this processes slightly faster. Add a new default avatar to Settings/Discussion There is a filter ‘avatar_defaults’. You can add more avatars here. You get an array of default … Read more

List all posts commented by current user

If we want to avoid any filters and manual SQL queries, we could try (untested): $args = array( ‘post_type’ => ‘foods’, ‘posts_per_page’ => 5, ‘post__in’ => array_unique( wp_list_pluck( get_comments( array( ‘user_id’ => get_current_user_id() ) ), ‘comment_post_ID’ ) ), ); $my_query = new WP_Query( $args );

Display Authors Comments on Profile Page

What you need to use here is the WP_Comment_Query() function. So on the author.php page, you can easily get the author info and ID as followed: // get author info $curauth = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name) : get_userdata(intval($author)); // set ID $user_id = $curauth->ID; Then we add the user ID in the query arguments array: … Read more

Remove Comments Metabox but still allow comments

Don’t remove this via CSS. The _POST part is also active and WP save the data! Use the hooks to remove meta boxes; code by scratch. function fb_remove_comments_meta_boxes() { remove_meta_box( ‘commentstatusdiv’, ‘post’, ‘normal’ ); remove_meta_box( ‘commentstatusdiv’, ‘page’, ‘normal’ ); // remove trackbacks remove_meta_box( ‘trackbacksdiv’, ‘post’, ‘normal’ ); remove_meta_box( ‘trackbacksdiv’, ‘page’, ‘normal’ ); } add_action( ‘admin_init’, … Read more

3 moderators to approve comment

you can use comment_unapproved_to_approved action hook to call your function which will use a commentmeta field to count how many times that comment has been approved or by how many users and if it’s less then 3 then we updated the comment to not approved : update I’m posting an updated code in the form … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)