Skip to:
Content

BuddyPress.org

Changeset 371


Ignore:
Timestamp:
10/02/2008 05:47:14 AM (18 years ago)
Author:
apeatling
Message:

Fixed missing user ID on blog post deletion.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs.php

    r365 r371  
    250250        global $bp;
    251251       
     252        if ( !$bp ) {
     253                bp_core_setup_globals();
     254                bp_blogs_setup_globals();
     255        }
     256       
    252257        if ( !$user_id )
    253258                $user_id = $bp['loggedin_userid'];
    … …  
    270275function bp_blogs_record_post($post_id = '') {
    271276        global $bp, $current_blog;
     277       
     278        if ( !$bp ) {
     279                bp_core_setup_globals();
     280                bp_blogs_setup_globals();
     281        }
    272282       
    273283        $post_id = (int)$post_id;
    … …  
    398408
    399409function bp_blogs_remove_post( $post_id = '' ) {
    400         global $current_blog;
     410        global $current_blog, $bp;
     411       
     412        if ( !$bp ) {
     413                bp_core_setup_globals();
     414                bp_blogs_setup_globals();
     415        }
    401416       
    402417        $post_id = (int)$post_id;
    403418        $blog_id = (int)$current_blog->blog_id;
    404419
    405         BP_Blogs_Post::delete( $post_id, $blog_id );
     420        BP_Blogs_Post::delete( $post_id, $blog_id, $bp['loggedin_userid'] );
    406421}
    407422add_action( 'delete_post', 'bp_blogs_remove_post' );
    408423
    409424function bp_blogs_remove_comment( $comment_id = '' ) {
    410         global $current_blog;
     425        global $current_blog, $bp;
     426       
     427        if ( !$bp ) {
     428                bp_core_setup_globals();
     429                bp_blogs_setup_globals();
     430        }
    411431       
    412432        $comment_id = (int)$comment_id;
    413433        $blog_id = (int)$current_blog->blog_id;
    414434       
    415         BP_Blogs_Comment::delete( $comment_id, $blog_id );     
     435        BP_Blogs_Comment::delete( $comment_id, $blog_id, $bp['loggedin_userid'] );     
    416436}
    417437add_action( 'delete_comment', 'bp_blogs_remove_comment' );
    … …  
    437457        global $wpdb, $bp;
    438458       
     459        if ( !$bp ) {
     460                bp_core_setup_globals();
     461                bp_blogs_setup_globals();
     462        }       
     463       
    439464        $user_id = $bp['loggedin_userid'];
    440465        $blogs = get_blogs_of_user($user_id);
  • trunk/bp-blogs/bp-blogs-classes.php

    r359 r371  
    151151       
    152152        function delete( $post_id, $blog_id, $user_id = null ) {
    153                 global $wpdb, $bp;
    154                
    155                 if ( !$user_id )
    156                         $user_id = $bp['loggedin_userid'];
     153                global $wpdb, $bp, $current_user;
     154               
     155                if ( !$user_id )
     156                        $user_id = $current_user->ID;
    157157
    158158                return $wpdb->query( $wpdb->prepare( "DELETE FROM " . $bp['blogs']['table_name_blog_posts'] . " WHERE user_id = %d AND blog_id = %d AND post_id = %d", $user_id, $blog_id, $post_id ) );
  • trunk/bp-core.php

    r370 r371  
    222222        /* Check to see if this is a user home, and if it is, get the user id */
    223223        if ( !$current_userid = bp_core_get_homebase_userid( $blog_id ) )
    224                 return false; // return 0 if this is a normal blog, and not a user home.
     224                return false; // return false if this is a normal blog, and not a user home.
    225225       
    226226        return $current_userid;
Note: See TracChangeset for help on using the changeset viewer.