check_role_update example

if ( ! empty( $request['id'] ) ) {
            return new WP_Error(
                'rest_user_exists',
                __( 'Cannot create existing user.' ),
                array( 'status' => 400 )
            );
        }

        $schema = $this->get_item_schema();

        if ( ! empty( $request['roles'] ) && ! empty( $schema['properties']['roles'] ) ) {
            $check_permission = $this->check_role_update( $request['id']$request['roles'] );

            if ( is_wp_error( $check_permission ) ) {
                return $check_permission;
            }
        }

        $user = $this->prepare_item_for_database( $request );

        if ( is_multisite() ) {
            $ret = wpmu_validate_user_signup( $user->user_login, $user->user_email );

            
Home | Imprint | This part of the site doesn't use cookies.