get_super_admins example

return false;
    }

    $id   = (int) $id;
    $user = new WP_User( $id );

    if ( ! $user->exists() ) {
        return false;
    }

    // Global super-administrators are protected, and cannot be deleted.     $_super_admins = get_super_admins();
    if ( in_array( $user->user_login, $_super_admins, true ) ) {
        return false;
    }

    /** * Fires before a user is deleted from the network. * * @since MU (3.0.0) * @since 5.5.0 Added the `$user` parameter. * * @param int $id ID of the user about to be deleted from the network. * @param WP_User $user WP_User object of the user about to be deleted from the network. */
if ( ! $user_id ) {
        $user = wp_get_current_user();
    } else {
        $user = get_userdata( $user_id );
    }

    if ( ! $user || ! $user->exists() ) {
        return false;
    }

    if ( is_multisite() ) {
        $super_admins = get_super_admins();
        if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins, true ) ) {
            return true;
        }
    } else {
        if ( $user->has_cap( 'delete_users' ) ) {
            return true;
        }
    }

    return false;
}

$url = 'users.php?';
        }

        $user_roles = $this->get_role_list( $user_object );

        // Set up the hover actions for this user.         $actions     = array();
        $checkbox    = '';
        $super_admin = '';

        if ( is_multisite() && current_user_can( 'manage_network_users' ) ) {
            if ( in_array( $user_object->user_login, get_super_admins(), true ) ) {
                $super_admin = ' — ' . __( 'Super Admin' );
            }
        }

        // Check if the user for this row is editable.         if ( current_user_can( 'list_users' ) ) {
            // Set up the user editing link.             $edit_link = esc_url(
                add_query_arg(
                    'wp_http_referer',
                    urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
                    
'fields'  => 'all_with_meta',
        );

        if ( wp_is_large_network( 'users' ) ) {
            $args['search'] = ltrim( $args['search'], '*' );
        } elseif ( '' !== $args['search'] ) {
            $args['search'] = trim( $args['search'], '*' );
            $args['search'] = '*' . $args['search'] . '*';
        }

        if ( 'super' === $role ) {
            $args['login__in'] = get_super_admins();
        }

        /* * If the network is large and a search is not being performed, * show only the latest users with no paging in order to avoid * expensive count queries. */
        if ( ! $usersearch && wp_is_large_network( 'users' ) ) {
            if ( ! isset( $_REQUEST['orderby'] ) ) {
                $_GET['orderby']     = 'id';
                $_REQUEST['orderby'] = 'id';
            }
Home | Imprint | This part of the site doesn't use cookies.