Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/23/2022 02:21:19 AM (2 years ago)
Author:
imath
Message:

Make sure an activity is created when adding a site from network admin

When the Blogs component is active, creating a new public site from
front-end and now from the WordPress network administration is generating
a new_blog activity type.

Closes https://github.com/buddypress/buddypress/pull/28
Fixes #8756

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-functions.php

    r13236 r13343  
    351351function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
    352352
    353     if ( empty( $user_id ) )
     353    if ( empty( $user_id ) ) {
    354354        $user_id = bp_loggedin_user_id();
     355    }
    355356
    356357    // If blog is not recordable, do not record the activity.
    357     if ( !bp_blogs_is_blog_recordable( $blog_id, $user_id ) )
     358    if ( ! bp_blogs_is_blog_recordable( $blog_id, $user_id ) ) {
    358359        return false;
     360    }
    359361
    360362    $name = get_blog_option( $blog_id, 'blogname' );
     
    382384    $recorded_blog->blog_id = $blog_id;
    383385    $recorded_blog_id       = $recorded_blog->save();
    384     $is_recorded            = !empty( $recorded_blog_id ) ? true : false;
     386    $is_recorded            = ! empty( $recorded_blog_id ) ? true : false;
    385387
    386388    bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'url', $url );
     
    393395    bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'comment_moderation', $moderation );
    394396
    395     $is_private = !empty( $_POST['blog_public'] ) && (int) $_POST['blog_public'] ? false : true;
    396 
    397397    /**
    398398     * Filters whether or not a new blog is public.
     
    402402     * @param bool $is_private Whether or not blog is public.
    403403     */
    404     $is_private = !apply_filters( 'bp_is_new_blog_public', !$is_private );
     404    $is_private = ! apply_filters(
     405        'bp_is_new_blog_public',
     406        (bool) get_blog_option( $blog_id, 'blog_public' )
     407    );
    405408
    406409    /**
Note: See TracChangeset for help on using the changeset viewer.