Posting Comments on External Page via Flash
I am posting a comments through Flash by hooking into wordpress’ AJAX with jquery. Everything goes into the database with out a hitch. I also have a custom loop for comments and posts that generates custom XML for a Flash Component. In order for me to update the BuddyPress wp_bp_user_blogs_comments table I have to get the latest comment in the wp_4_comments table here is my code:
$lastest_comment_id = $wpdb->get_var( $wpdb->prepare(“SELECT MAX(comment_ID) FROM $wptable”) );
$latest_comment_date = $wpdb->get_var( $wpdb->prepare(“SELECT comment_date FROM $wptable WHERE comment_ID = $lastest_comment_id” ) );
$new_comment = new BP_JOURNAL_COMMENT;
$new_comment->user_id = $user_id;
$new_comment->blog_id = $blog_id;
$new_comment->comment_id = $lastest_comment_id;
$new_comment->comment_post_id = $post_id;
$new_comment->date_created = $latest_comment_date;
Is there an easier way to do this because my concern is that if two or more people comment on the same post close to the same time then it might grab the wrong comment to update the wp_bp_user_blogs_comments table with … any help would be greatly appreciated.
- The topic ‘Posting Comments on External Page via Flash’ is closed to new replies.