The MU forums have moved to WordPress.org

how we echo how many blogs do we have on our server? (7 posts)

  1. samfingcul
    Member
    Posted 15 years ago #

    hi.
    I'd like to put on my main wordpress MU page.. how many blogs do I have at this moment. how can I do that ?
    to be something like: we currently have %X blogs.

    thanks

  2. dsader
    Member
    Posted 15 years ago #

    Rellocate the bit of code from the wpmu-admin.php

    global $wpdb;
    $c_users = $wpdb->get_var("SELECT COUNT(id) FROM {$wpdb->users}");
    $c_blogs = $wpdb->get_var("SELECT COUNT(blog_id) FROM {$wpdb->blogs}");
    $user_text = sprintf( __ngettext( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
    $blog_text = sprintf( __ngettext( '%s blog', '%s blogs', $c_blogs ), number_format_i18n( $c_blogs ) );
    $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
    echo $sentence;
  3. samfingcul
    Member
    Posted 15 years ago #

    i tried that too, but it says:
    Fatal error: Call to a member function get_var() on a non-object

  4. d_kc
    Member
    Posted 15 years ago #

    <?php
    
        $stats = get_sitestats();
        echo "There are ".$stats[ 'blogs' ]." active blogs and ".$stats[ 'users' ]." registered users.";
    
    ?>
  5. indojepang
    Member
    Posted 15 years ago #

    thank's d-kc!

  6. d_kc
    Member
    Posted 15 years ago #

    No prob. Thats what I'm using. Took me a few hours to find it. :)

  7. samfingcul
    Member
    Posted 15 years ago #

    thanks

About this Topic

  • Started 15 years ago by samfingcul
  • Latest reply from samfingcul