Skip to:
Content
Pages
Categories
Search
Top
Bottom

Posting Comments on External Page via Flash

  • Avatar of J Dub
    J Dub
    Participant

    @jamieweb

    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;

    $new_comment->save();

    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.

Viewing 1 replies (of 1 total)
  • Avatar of J Dub
    J Dub
    Participant

    @jamieweb

    Can anyone help with this. I still haven’t figured out a way better way of doing this ….

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.