bp_blogs_validate_blog_signup()

Process a blog registration submission.

Description

Passes submitted values to wpmu_create_blog().

Return

(bool) True on success, false on failure.

Source

File: bp-blogs/bp-blogs-template.php

1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
function bp_blogs_validate_blog_signup() {
    global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path, $current_site;
 
    if ( !check_admin_referer( 'bp_blog_signup_form' ) )
        return false;
 
    $current_user = wp_get_current_user();
 
    if( !is_user_logged_in() )
        die();
 
    $result = bp_blogs_validate_blog_form();
    extract($result);
 
    if ( $errors->get_error_code() ) {
        unset($_POST['submit']);
        bp_show_blog_signup_form( $blogname, $blog_title, $errors );
        return false;
    }
 
    $public = (int) $_POST['blog_public'];
 
    // Depreciated.
    $meta = apply_filters( 'signup_create_blog_meta', array( 'lang_id' => 1, 'public' => $public ) );
 
    /**
     * Filters the default values for Blog meta.
     *
     * @since BuddyPress 1.0.0
     *
     * @param array $meta {
     *      string $value  Default blog language ID.
     *      string $public Default public status.
     * }
     */
    $meta = apply_filters( 'add_signup_meta', $meta );
 
    // If this is a subdomain install, set up the site inside the root domain.
    if ( is_subdomain_install() )
        $domain = $blogname . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
 
    $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
    bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
    return true;
}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.