Commenting in user profile page?

Hi @Towfiq: Comments are related in the database to Posts. You’ll have to do a lot of work to get Comments to relate to Users. Have you considered creating a Custom Post Type for Users and then use either a user_meta field to store the post_id, or a postmeta field to store the user_id, or … Read more

Approve comment hook?

Just like posts, a comment can have an array of different statuses, so instead of naming a hook with each status, they have transition hooks, which tell you what status it had before and what’s the new status. In your case, this might do the trick: add_action(‘transition_comment_status’, ‘my_approve_comment_callback’, 10, 3); function my_approve_comment_callback($new_status, $old_status, $comment) { … Read more

How to make comments work for a post loaded per Ajax?

To quote the Codex on the have_comments function: This function relies upon the global $wp_query object to be set – this is usually the case from within The Loop The problem is that your ajax handler creates its own WP_Query object. Note that you are not calling the_post(), instead you are calling $posti->the_post(). Same logic … Read more

Non-threaded comment replies with link to original comment

This is my solution and not the proposed solution suggested on the WordPress forums. It turns out to be fairly easy, but involves a few steps. 1) Go to wp-admin->Settings->Discussion and switch off threaded comments. This will disable threading, which we want, but will also remove the ability for us to “reply to” a particular … Read more

Filtering the Admin Comments List to Show Only Comments from the Current User?

Either of these 3 will help you: //Before getting the comments, on the WP_Comment_Query object for each comment add_action(‘pre_get_comments’, ‘wpse56652_filt_comm’); //Applied on the comments SQL Query, you can modify the ‘Where’ part of the query add_filter(‘comments_clauses’, ‘wpse56652_filt_comm’); //After the comments are fetched, you can modify the comments array add_filter(‘the_comments’, ‘wpse56652_filt_comm’); function wpse56652_filt_comm($param) { //access the … Read more

Find out which moderator approved comment?

To record the moderator that approves the comment: function wpse_comment_moderator_log( $comment ) { global $current_user; get_currentuserinfo(); update_comment_meta( $comment->comment_ID, ‘approved_by’, $current_user->user_login ); } add_action( ‘comment_unapproved_to_approved’, ‘wpse_comment_moderator_log’ ); To display it after the comment text: function wpse_display_moderator( $comment_text, $comment ) { $approved_by = get_comment_meta( $comment->comment_ID, ‘approved_by’, true ); if ( $approved_by ) { $comment_text .= ” – … Read more

Is it possible to pull comments from facebook into your blog?

I just added this feature to the beta branch of Simple Facebook Connect. It pulls comments back from auto-published stories and integrates them into the normal comments stream. Features: Integrated with Auto-Publish. When you post, and it’s auto-published to your Page or Profile, SFC notices and saves the resulting story IDs for later polling. Fast. … Read more

how to reduce the number of spam comments

For my blog, I too run Akismet to catch any spam that is posted to my blog, but I also prevent spam from being posted in the first place using a few plugins: Cookies For Comments requires that people leaving comments have cookies and CSS stylesheets enabled. A stylesheet is added to your site that … Read more

setting comments off as default for pages and custom post types?

From what I understand, you want to set pages and some custom post types to have commenting ‘off’ by default, while posts will still use the default option (i.e. commenting ‘on’). If this is the case, the following function will do it. function default_comments_off( $data ) { if( $data[‘post_type’] == ‘page’ && $data[‘post_status’] == ‘auto-draft’ … Read more