Upload images with comment

EDIT: With some help of a friend I came up with a solution. For everyone interested: Use a custom post-type, in my case comment_post. Then upload the images like this: $new_post = array( ‘post_title’ => $title, ‘post_content’ => $comment, ‘post_status’ => ‘pending’,// Choose: publish, preview, future, draft, etc. ‘post_type’ => ‘comments_post’ // Use a custom … Read more

count number of user comments with a specific comment meta value

Your basic question is a pure SQL question. $count = $wpdb->get_var( ‘SELECT COUNT( comments.comment_ID ) FROM ‘. $wpdb->comments .’ as comments LEFT JOIN ‘.$wpdb->commentmeta.’ AS cmeta ON comments.comment_ID = cmeta.comment_id WHERE user_id = 1 AND comment_approved = “1” AND comment_type NOT IN (“pingback”, “trackback” ) AND cmeta.meta_key = “rating” AND cmeta.meta_value = 5′ ); I … Read more

Add Comment Custom Field

Here you go: Adding Custom Fields to WordPress Comment Forms? And another awesome post on this: http://wpengineer.com/2214/adding-input-fields-to-the-comment-form/ Functions are available to add/update, delete comment meta, similar to post and user meta. Edit: Here’s an example to give you a start (put the code into the functions.php or in a custom plugin): Add the fields to … Read more

Query & Sort Comments by custom comment meta

Unfortunately it’s unsupported by the applicable WordPress functions for querying comments, which is primarily due to(i feel) not enough people(or anyone) yet asking for it. I want to highlight a couple of core files here to help understand the issue. First up comments-template.php, the comment_template function, it’s this function that queries for comments and then … Read more

Is it possible to show custom comment metadata in the admin panel?

To show the content on individual edit pages you need to add custom meta boxes to the comment edit page. You’ll use the key comment for the $page argument of add_meta_box. <?php add_action( ‘add_meta_boxes_comment’, ‘pmg_comment_tut_add_meta_box’ ); function pmg_comment_tut_add_meta_box() { add_meta_box( ‘pmg-comment-title’, __( ‘Comment Title’ ), ‘pmg_comment_tut_meta_box_cb’, ‘comment’, ‘normal’, ‘high’ ); } function pmg_comment_tut_meta_box_cb( $comment ) … Read more

Running a function on comment status change

The comment_post hook is called with a $comment_id as the first argument. You can see why your function is failing. Same goes for the edit_comment hook. Simply add the following at the beginning of your business function: if ( !is_object( $comment ) ) $comment = get_comment( $comment ); Do use a custom SQL query for … Read more

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