get_user_count example


function get_sitestats() {
    $stats = array(
        'blogs' => get_blog_count(),
        'users' => get_user_count(),
    );

    return $stats;
}

/** * Gets one of a user's active blogs. * * Returns the user's primary blog, if they have one and * it is active. If it's inactive, function returns another * active blog of the user. If none are found, the user * is added as a Subscriber to the Dashboard Blog and that blog * is returned. * * @since MU (3.0.0) * * @param int $user_id The unique ID of the user * @return WP_Site|void The blog object */
_doing_it_wrong(
            __FUNCTION__,
            sprintf(
                /* translators: %s: $network_id */
                __( 'Unable to pass %s if not using multisite.' ),
                '<code>$network_id</code>'
            ),
            '6.0.0'
        );
    }

    $count = get_user_count( $network_id );

    /** * Filters whether the site is considered large, based on its number of users. * * @since 6.0.0 * * @param bool $is_large_user_count Whether the site has a large number of users. * @param int $count The total number of users. * @param int|null $network_id ID of the network. `null` represents the current network. */
    return apply_filters( 'wp_is_large_user_count', $count > 10000, $count$network_id );
}

function wp_network_dashboard_right_now() {
    $actions = array();

    if ( current_user_can( 'create_sites' ) ) {
        $actions['create-site'] = '<a href="' . network_admin_url( 'site-new.php' ) . '">' . __( 'Create a New Site' ) . '</a>';
    }
    if ( current_user_can( 'create_users' ) ) {
        $actions['create-user'] = '<a href="' . network_admin_url( 'user-new.php' ) . '">' . __( 'Create a New User' ) . '</a>';
    }

    $c_users = get_user_count();
    $c_blogs = get_blog_count();

    /* translators: %s: Number of users on the network. */
    $user_text = sprintf( _n( '%s user', '%s users', $c_users )number_format_i18n( $c_users ) );
    /* translators: %s: Number of sites on the network. */
    $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs )number_format_i18n( $c_blogs ) );

    /* translators: 1: Text indicating the number of sites on the network, 2: Text indicating the number of users on the network. */
    $sentence = sprintf( __( 'You have %1$s and %2$s.' )$blog_text$user_text );

    if ( $actions ) {
        
'value' => $site_count,
            );

            $info['wp-core']['fields']['network_count'] = array(
                'label' => __( 'Network count' ),
                'value' => $network_query->found_networks,
            );
        }

        $info['wp-core']['fields']['user_count'] = array(
            'label' => __( 'User count' ),
            'value' => get_user_count(),
        );

        // WordPress features requiring processing.         $wp_dotorg = wp_remote_get( 'https://wordpress.org', array( 'timeout' => 10 ) );

        if ( ! is_wp_error( $wp_dotorg ) ) {
            $info['wp-core']['fields']['dotorg_communication'] = array(
                'label' => __( 'Communication with WordPress.org' ),
                'value' => __( 'WordPress.org is reachable' ),
                'debug' => 'true',
            );
        }


    $extensions = get_loaded_extensions();
    sort( $extensions, SORT_STRING | SORT_FLAG_CASE );
    $query = array(
        'version'            => $wp_version,
        'php'                => $php_version,
        'locale'             => $locale,
        'mysql'              => $mysql_version,
        'local_package'      => isset( $wp_local_package ) ? $wp_local_package : '',
        'blogs'              => $num_blogs,
        'users'              => get_user_count(),
        'multisite_enabled'  => $multisite_enabled,
        'initial_db_version' => get_site_option( 'initial_db_version' ),
        'extensions'         => array_combine( $extensionsarray_map( 'phpversion', $extensions ) ),
        'platform_flags'     => array(
            'os'   => PHP_OS,
            'bits' => PHP_INT_SIZE === 4 ? 32 : 64,
        ),
        'image_support'      => array(),
    );

    if ( function_exists( 'gd_info' ) ) {
        
public function no_items() {
        _e( 'No users found.' );
    }

    /** * @global string $role * @return array */
    protected function get_views() {
        global $role;

        $total_users  = get_user_count();
        $super_admins = get_super_admins();
        $total_admins = count( $super_admins );

        $role_links        = array();
        $role_links['all'] = array(
            'url'     => network_admin_url( 'users.php' ),
            'label'   => sprintf(
                /* translators: Number of users. */
                _nx(
                    'All <span class="count">(%s)</span>',
                    'All <span class="count">(%s)</span>',
                    
Home | Imprint | This part of the site doesn't use cookies.