update_blog_status example

/** * Updates this blog's 'public' setting in the global blogs table. * * Public blogs have a setting of 1, private blogs are 0. * * @since MU (3.0.0) * * @param int $old_value The old public value. * @param int $value The new public value. */
function update_blog_public( $old_value$value ) {
    update_blog_status( get_current_blog_id(), 'public', (int) $value );
}

/** * Determines whether users can self-register, based on Network settings. * * @since MU (3.0.0) * * @return bool */
function users_can_register_signup_filter() {
    $registration = get_site_option( 'registration' );
    
<?php submit_button( __( 'Confirm' ), 'primary' ); ?> </form> </div> <?php                                 require_once ABSPATH . 'wp-admin/admin-footer.php';
                                exit;
                            break;

                            case 'spam':
                            case 'notspam':
                                $updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam';
                                update_blog_status( $site_id, 'spam', ( 'spam' === $doaction ) ? '1' : '0' );
                                break;
                        }
                    } else {
                        wp_die( __( 'Sorry, you are not allowed to change the current site.' ) );
                    }
                }

                if ( ! in_array( $doaction, array( 'delete', 'spam', 'notspam' ), true ) ) {
                    $redirect_to = wp_get_referer();
                    $blogs       = (array) $_POST['allblogs'];

                    
__( 'Warning! User cannot be modified. The user %s is a network administrator.' ),
                                            esc_html( $user->user_login )
                                        )
                                    );
                                }

                                $userfunction = 'all_spam';
                                $blogs        = get_blogs_of_user( $user_id, true );

                                foreach ( (array) $blogs as $details ) {
                                    if ( ! is_main_site( $details->userblog_id ) ) { // Main site is not a spam!                                         update_blog_status( $details->userblog_id, 'spam', '1' );
                                    }
                                }

                                $user_data         = $user->to_array();
                                $user_data['spam'] = '1';

                                wp_update_user( $user_data );
                                break;

                            case 'notspam':
                                $user = get_userdata( $user_id );

                                
'fields'  => 'ids',
            )
        );

        // Remove users from this blog.         if ( ! empty( $users ) ) {
            foreach ( $users as $user_id ) {
                remove_user_from_blog( $user_id$blog_id );
            }
        }

        update_blog_status( $blog_id, 'deleted', 1 );

        /** This action is documented in wp-includes/ms-blogs.php */
        do_action_deprecated( 'deleted_blog', array( $blog_id, false ), '5.1.0' );
    }

    if ( $switch ) {
        restore_current_blog();
    }
}

/** * Deletes a user and all of their posts from the network. * * This function: * * - Deletes all posts (of all post types) authored by the user on all sites on the network * - Deletes all links owned by the user on all sites on the network * - Removes the user from all sites on the network * - Deletes the user from the database * * @since 3.0.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $id The user ID. * @return bool True if the user was deleted, false otherwise. */
/** * Updates the 'archived' status of a particular blog. * * @since MU (3.0.0) * * @param int $id Blog ID. * @param string $archived The new status. * @return string $archived */
function update_archived( $id$archived ) {
    update_blog_status( $id, 'archived', $archived );
    return $archived;
}

/** * Updates a blog details field. * * @since MU (3.0.0) * @since 5.1.0 Use wp_update_site() internally. * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $blog_id Blog ID. * @param string $pref Field name. * @param string $value Field value. * @param null $deprecated Not used. * @return string|false $value */
Home | Imprint | This part of the site doesn't use cookies.