Skip to:
Content

BuddyPress.org

Changeset 843


Ignore:
Timestamp:
01/13/2009 10:59:17 PM (18 years ago)
Author:
apeatling
Message:

Added optional parameters to the record_post and record_comment functions so they can be used by plugins and in other areas.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs.php

    r836 r843  
    365365add_action( 'wpmu_new_blog', 'bp_blogs_record_blog', 10, 2 );
    366366
    367 function bp_blogs_record_post($post_id) {
     367function bp_blogs_record_post( $post_id, $blog_id = false, $user_id = false ) {
    368368        global $bp, $current_blog;
    369369       
     
    374374       
    375375        $post_id = (int)$post_id;
    376         $user_id = (int)$bp['loggedin_userid'];
    377         $blog_id = (int)$current_blog->blog_id;
     376       
     377        if ( !$user_id )
     378                $user_id = (int)$bp['loggedin_userid'];
     379               
     380        if ( !$blog_id )
     381                $blog_id = (int)$current_blog->blog_id;
    378382
    379383        /* This is to stop infinate loops with Donncha's sitewide tags plugin */
     
    431435add_action( 'publish_post', 'bp_blogs_record_post' );
    432436
    433 function bp_blogs_record_comment( $comment_id, $from_ajax = false ) {
     437function bp_blogs_record_comment( $comment_id, $post_id = false, $blog_id = false, $from_ajax = false ) {
    434438        global $bp, $current_blog, $current_user;
    435439
     
    448452        if ( $user_id ) {
    449453                $comment_id = (int)$comment_id;
    450                 $blog_id = (int)$current_blog->blog_id;
    451                 $post_id = (int)$comment->comment_post_ID;
    452        
     454               
     455                if ( !$post_id )
     456                        $post_id = (int)$comment->comment_post_ID;
     457
     458                if ( !$blog_id )
     459                        $blog_id = (int)$current_blog->blog_id;
     460                       
    453461                /**
    454462                 * Check how many recorded posts there are for the user. If we are
     
    518526                bp_blogs_remove_comment( $comment_id );
    519527        } else {
    520                 bp_blogs_record_comment( $comment_id, true );           
     528                bp_blogs_record_comment( $comment_id, false, false, true );             
    521529        }
    522530}
Note: See TracChangeset for help on using the changeset viewer.