The MU forums have moved to WordPress.org

Theme Stats plugin (15 posts)

  1. andrea_r
    Moderator
    Posted 17 years ago #

    Ron and I whipped this up based on previous code of ours and from the plugin Phillip Studinski (forgot your forum username, sorry!) whipped up from that. :)

    (Confused? Is okay. Me too.)

    This plugin goes in the mu-plugins folder. It adds a sub-menu to Site Admin, which will list all the themes in use site-wide. At the top of the list will be the most popular theme and a number in brackets of how many are in use. Click on the name, and a drop-down list will appear of all users using that theme, with a link to each user's blog and backend.

    We're pretty visual people ourselves, and I like stats and menus in the backend so I know who is using what, thus this plugin was born. (I coded the easy bits; I'll admit it. :D I'm getting really good at adding menus.)

    I even made it available in two places:
    http://atypicalhomeschool.net/wordpress-plugins/
    http://wpmudevorg.wordpress.com/project/Theme-Stats

    This is an especially usefull plugin if you've got an issue with a particular theme and you need to know quickly if all users with that theme are having the same issue. My users frequently add uls, lis and even divs willy-nilly to their sidebars and then complain their theme is busted.

  2. amanzi
    Member
    Posted 17 years ago #

    Hi - just a suggestion... How about also listing the themes that are not in use? i.e. they would be listed last with "(0)" next to their name. I find it useful to know which themes aren't being used.

    Cheers - Stuart.

  3. andrea_r
    Moderator
    Posted 17 years ago #

    Yeah, we thought of that too, but got stumped (mental block) on how to pull the info.

    Not used theme = not stored in db.

  4. dsader
    Member
    Posted 17 years ago #

    andrea_r,
    I added path to:$blogs = $wpdb->get_results("SELECT blog_id, domain, path FROM $wpdb->blogs ORDER BY path ASC");

    Could you add an if non-vhost:
    <?php
    foreach($themeblogs[$themename] as $bloginfo) {
    $domain = explode('.',$bloginfo->path);
    $frontend = "http://" . $bloginfo->domain . "" . $bloginfo->path . "";
    $backend = "http://" . $bloginfo->domain . "" . $bloginfo->path . "wp-admin/";
    echo '<li><a href="' . $frontend . '">' . $domain[0] . '</a> - <a href ="' . $backend . '">Backend</a></li>';
    } ?>

    Thanx, I loves what you do.

  5. amanzi
    Member
    Posted 17 years ago #

    I guess it's not that easy, huh? What if you got the array of themes first, and then looped through your function adding each time a theme is used. Then you'd just need to subtract 1 from each count of each theme. Then you'd end up with a bunch of themes that have a zero count.

    Does that make sense?

  6. andrea_r
    Moderator
    Posted 17 years ago #

    Yeah, it makes sense. :)

  7. amanzi
    Member
    Posted 17 years ago #

    Cool - it made sense in my head, but didn't appear to be very logical when I typed it.

  8. Konstan
    Member
    Posted 17 years ago #

    Hi, I installed this plugin and had to use the non-vhost solution added by dsader and it works, almost.

    It shows everything correctly, but when clicking on a theme to view who is using it, it lists the people using the theme and after the whole list it adds a duplicate for each entry as my main domain.

    I get this:

    WordPress Mu default theme (3)
    User 1 - Backend
    User 2 - Backend
    User 3 - Backend
    Bloghost - Backend
    Bloghost - Backend
    Bloghost - Backend

    The user 1 2 3 link to their blogs correctly, as does the backend link, but then I get those bloghost (my domain) listed there and it goes to the main site, and the backend goes to my admin backend. This occurs with every theme.

    I got the original code plus the additional code from a few posts above. How can I fix this?

  9. lunabyte
    Member
    Posted 17 years ago #

    Try this, from a quick glance:

    $blogs = $wpdb->get_results("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE blog_id > 1 ORDER BY path ASC");

    Essentially, skipping the primary blog. Who cares what theme "you" are using, since most likely it isn't available to anyone else anyway.

  10. Konstan
    Member
    Posted 17 years ago #

    Tried that, didnt fix it.

    Its not really that important, since all I needed was the numbers. Which is weird, the numbers show up correctly, but when you view the list there are twice as many blogs listed.

  11. andrea_r
    Moderator
    Posted 17 years ago #

    That's really weird; it's working for everyone else. Did it work without the extra code (ie, a clean version)?

  12. Konstan
    Member
    Posted 17 years ago #

    Nope, because I run a non-vhost wpmu.

  13. mamaestes
    Member
    Posted 16 years ago #

    I am getting an accurate listing of theme use (numbers) but all of the user links are directing me right back to my admin blog! I'm not sure if I need to install the code above...could someone tell me if this is a common problem?

  14. andrea_r
    Moderator
    Posted 16 years ago #

    Are you on a subdomain install or a subfolder one?

  15. mamaestes
    Member
    Posted 16 years ago #

    We had to go subfolder as our set up would not allow for subdomains...(we're a school district). URL is wpmu.burlesonisd.net

About this Topic

  • Started 17 years ago by andrea_r
  • Latest reply from mamaestes