views:

23

answers:

1

I am currently maintaining some Wordpress MU installations ( v2.9.x )

I want to create a report ( outside of wordpress ) to count the number of users that I have, and the number of blogs that I have. Each blog gets it's own tables.

I have 4 questions:

  1. First question, do you know of a plugin that does this already? I couldn't find one.

  2. How can I get an accurate count of active users? Using this SQL?:

    SELECT count(*) FROM wp_users WHERE deleted = 0

  3. How can I get an accurate count of active blogs? Using this SQL?

    SELECT count(*) FROM wp_blogs WHERE deleted = 0

  4. I plan to do this outside of Wordpress. Is there any advantage to creating these reports from within Wordpress? The SQL seems straight forward, I'm wondering if there is a benefit to using the Wordpress codex to generate these reports.

Thanks

+1  A: 

Since you have so many questions, it's a bit harder to get an answer from time to time.

As for #2 and #3, have you considered making a function in your functions.php file that will run those queries exactly like that, return them in an array and then you can output that wherever you want?

The advantage of doing it within Wordpress is the simplicity of calling it. You can create a shortcode very easily to reference it anywhere in your pages, etc.

Just make your function, and then add to your functions.php file:

add_shortcode('SHORTTAG', 'FUNCTION NAME');

That's just one benefit, but keeping things within Wordpress just makes it more tidy and portable. If you ever need to do it again, it's just a copy and paste from functions file to functions file.

The reports would be easy to make, and you can even use Wordpress functions to store, email or display them much easier then hand-bombing PHP yourself.

gamerzfuse