Example #1
0
function bp_blogs_remove_data_for_blog($blog_id)
{
    global $bp;
    do_action('bp_blogs_before_remove_data_for_blog', $blog_id);
    // If this is regular blog, delete all data for that blog.
    BP_Blogs_Blog::delete_blog_for_all($blog_id);
    // Delete activity stream item
    bp_blogs_delete_activity(array('item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => false));
    do_action('bp_blogs_remove_data_for_blog', $blog_id);
}
/**
 * Remove the all data related to a given blog from the BP blogs tracker and activity stream.
 *
 * @param int $blog_id The ID of the blog to expunge.
 */
function bp_blogs_remove_data_for_blog($blog_id)
{
    global $bp;
    /**
     * Fires before all data related to a given blog is removed from blogs tracker
     * and activity stream.
     *
     * @since BuddyPress (1.5.0)
     *
     * @param int $blog_id ID of the blog whose data is being removed.
     */
    do_action('bp_blogs_before_remove_data_for_blog', $blog_id);
    // If this is regular blog, delete all data for that blog.
    BP_Blogs_Blog::delete_blog_for_all($blog_id);
    // Delete activity stream item
    bp_blogs_delete_activity(array('item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => false));
    /**
     * Fires after all data related to a given blog has been removed from blogs tracker
     * and activity stream.
     *
     * @since BuddyPress (1.0.0)
     *
     * @param int $blog_id ID of the blog whose data is being removed.
     */
    do_action('bp_blogs_remove_data_for_blog', $blog_id);
}
Example #3
0
function bp_blogs_remove_data_for_blog($blog_id)
{
    global $bp;
    /* If this is regular blog, delete all data for that blog. */
    BP_Blogs_Blog::delete_blog_for_all($blog_id);
    BP_Blogs_Post::delete_posts_for_blog($blog_id);
    BP_Blogs_Comment::delete_comments_for_blog($blog_id);
    // Delete activity stream item
    bp_blogs_delete_activity(array('item_id' => $blog_id, 'component_name' => 'blogs', 'component_action' => false, 'user_id' => $bp->loggedin_user->id));
    do_action('bp_blogs_remove_data_for_blog', $blog_id);
}
/**
 * Remove a blog post activity item from the activity stream.
 *
 * @since 1.0.0
 *
 * @param int $post_id ID of the post to be removed.
 * @param int $blog_id Optional. Defaults to current blog ID.
 * @param int $user_id Optional. Defaults to the logged-in user ID. This param
 *                     is currently unused in the function (but is passed to hooks).
 * @return bool
 */
function bp_blogs_remove_post($post_id, $blog_id = 0, $user_id = 0)
{
    global $wpdb;
    if (empty($wpdb->blogid)) {
        return false;
    }
    $post_id = (int) $post_id;
    if (!$blog_id) {
        $blog_id = (int) $wpdb->blogid;
    }
    if (!$user_id) {
        $user_id = bp_loggedin_user_id();
    }
    /**
     * Fires before removal of a blog post activity item from the activity stream.
     *
     * @since 1.5.0
     *
     * @param int $blog_id ID of the blog associated with the post that was removed.
     * @param int $post_id ID of the post that was removed.
     * @param int $user_id ID of the user having the blog removed for.
     */
    do_action('bp_blogs_before_remove_post', $blog_id, $post_id, $user_id);
    bp_blogs_delete_activity(array('item_id' => $blog_id, 'secondary_item_id' => $post_id, 'component' => buddypress()->blogs->id, 'type' => 'new_blog_post'));
    /**
     * Fires after removal of a blog post activity item from the activity stream.
     *
     * @since 1.0.0
     *
     * @param int $blog_id ID of the blog associated with the post that was removed.
     * @param int $post_id ID of the post that was removed.
     * @param int $user_id ID of the user having the blog removed for.
     */
    do_action('bp_blogs_remove_post', $blog_id, $post_id, $user_id);
}
/**
 * Remove the all data related to a given blog from the BP blogs tracker and activity stream.
 *
 * @param int $blog_id The ID of the blog to expunge.
 */
function bp_blogs_remove_data_for_blog($blog_id)
{
    /**
     * Fires before all data related to a given blog is removed from blogs tracker
     * and activity stream.
     *
     * @since 1.5.0
     *
     * @param int $blog_id ID of the blog whose data is being removed.
     */
    do_action('bp_blogs_before_remove_data_for_blog', $blog_id);
    // If this is regular blog, delete all data for that blog.
    BP_Blogs_Blog::delete_blog_for_all($blog_id);
    /**
     * Delete activity stream item only if the Activity component is active
     *
     * @see https://buddypress.trac.wordpress.org/ticket/6937
     */
    if (bp_is_active('activity')) {
        bp_blogs_delete_activity(array('item_id' => $blog_id, 'component' => buddypress()->blogs->id, 'type' => false));
    }
    /**
     * Fires after all data related to a given blog has been removed from blogs tracker
     * and activity stream.
     *
     * @since 1.0.0
     *
     * @param int $blog_id ID of the blog whose data is being removed.
     */
    do_action('bp_blogs_remove_data_for_blog', $blog_id);
}