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

Show comments from multiple post IDs in comment template

you can get comments from each post by its id with $comments253 = get_comments(‘post_id=253’); $comments724 = get_comments(‘post_id=724’); $comments798 = get_comments(‘post_id=798’); then merge ( array-merge ) and sort the array by date ( comment->comment_date being the key to the date value) if you want. then just foreach($comments as $comment) : echo($comment->comment_author . ‘<br />’ . $comment->comment_content); … Read more

Success message in comment form

Without Ajax or plugins. Add to function.php: add_action( ‘set_comment_cookies’, function( $comment, $user ) { setcookie( ‘ta_comment_wait_approval’, ‘1’ ); }, 10, 2 ); add_action( ‘init’, function() { if( $_COOKIE[‘ta_comment_wait_approval’] === ‘1’ ) { setcookie( ‘ta_comment_wait_approval’, null, time() – 3600, “https://wordpress.stackexchange.com/” ); add_action( ‘comment_form_before’, function() { echo “<p id=’wait_approval’ style=”padding-top: 40px;”><strong>Your comment has been sent successfully.</strong></p>”; }); … Read more

Parent comment’s author name

In your comment callback, you could get that info with the help of the comment_parent property of the current $comment object. We can then use the comment_author() function to display the comment author’s name: // Display the parent comment author’s name: if( $comment->comment_parent ) comment_author( $comment->comment_parent ); and the comment_author_link() function to display the comment … Read more

Link name in comments to Author page? Comment Author Meta in Comments?

Edited my answer since the original code was slightly flawed. Tested and triplechecked this to make sure it does exactly what you’ve requested. 🙂 Enjoy! function comment_author_profile_link(){ /* Get the comment author information */ global $comment; $comment_ID = $comment->user_id; $author = get_comment_author( $comment_ID ); $url = get_comment_author_url( $comment_ID ); /* Check if commenter is registered … Read more

Comment Count for each Comment Author

Place this in your functions.php theme file: <?php function ps_count_user_comments() { global $wpdb; $count = $wpdb->get_var( ‘SELECT COUNT(comment_ID) FROM ‘ . $wpdb->comments. ‘ WHERE comment_author_email = “‘ . get_comment_author_email() . ‘” AND comment_approved = “1” AND comment_type IN (“comment”, “”)’ ); return $count . ‘ comments’; } ?> This code will count the author comments … Read more

How do I set up real anonymous posting in bbpress forums? [closed]

When we post an empty anonymous reply, we get the following errors: The part of BBPress that’s responsible for handling this, is the bbp_new_reply_handler() function, in the file /bbpress/includes/replies/functions.php. It contains these lines that are of interest to us: // User is anonymous if ( bbp_is_anonymous() ) { // Filter anonymous data $anonymous_data = bbp_filter_anonymous_post_data(); … Read more

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