Monthly Archives: September 2009

Love This Site Awards :: Myth Games – DivineCaroline

“One of my sites has been nominated for a DivineCaroline ‘Love This Site’ award! If you’d like to show your support for the site, please vote 🙂 Creating an account only takes a moment, and I’d be extremely grateful.”
No pressure or anything, but I think this site deserves to win a Love! This Site Award from DivineCaroline, so please, vote soon! You can also still nominate your favorite sites.
Advertisements

Hiding the WordPress-MU Dashboard

This post is intended to accompany Chapter 4 of my book, the WordPress-MU 2.7 Beginner’s Guide.

If you have a WordPress or WordPress-MU powered blog, then you’ve probably noticed the dashboard.  It’s the default ‘landing page’ when you log in to your admin panel.  The dashboard provides some useful information, such as the number of posts you’ve made, the number of comments that have been approved and the number that are awaiting moderation, and even a traffic stats graph.

However, the dashboard can take a long time to load.  This isn’t a problem for everyone – if you’re blessed with a nice fast cable or DSL connection it probably isn’t an issue for you.  But not everyone has a good connection.  I’m making this post via mobile broadband because my usual connection has failed. HSDPA isn’t reliable in this area, so I’m on 3G, and even a page as clean as Google’s is taking an irritating length of time to load.

You can remove some of the clutter from the Dashboard by using the ‘Screen Options’, but you will still land on the Dashboard page when you log in to the admin panel.dashboardPersonally, I don’t mind the dashboard on my main blogs, but I have some niche blogs on various community sites, and my favourite sites are the ones that blur the line between ‘community’ and ‘blog’.  When you go to manage your blog, you are dumped straight on to the Write Post page – after all, the chances are that’s why you’re visiting the admin panel of your blog.

Sending your users straight to the ‘Write Post’ page will most likely be saving them a click or two.  If it turns out they wanted to do something else, then it hasn’t cost them much time.

If you want to hide the dashboard, then one way to do so is to use the ‘Hide Dashboard‘ Plugin created by Bavotasan.  This plugin will allow you to hide the dashboard for users with certain user levels.

The default version of the plugin hides the dashboard for users who are not admin.  If you would like to hide the dashboard for everyone, you can do that with a simple edit:

Just open the plugin file, and remove the following lines of code:

if (current_user_can(‘level_10’)) {

return;

} else {

Also remove the closing ‘}’ above the ‘add_action’ line near the end of the plugin file.

For your convenience, you can download the edited version of the plugin here.

Editing UserThemes Revisited

This post is designed to accompany Chapter 4 of my book, the WordPress-MU 2.7 Beginner’s Guide.

Would you like to allow users to edit their themes on your WordPress-MU blog?  One of the most common requests from users on WordPress-MU sites is the ability to edit the themes that are offered.  Giving users the ability to edit the PHP files that make up a WordPress-MU theme is a little risky, but it is possible to allow users to edit CSS files, which will give them some freedom to customize their site, and is much less risky from the site owner’s point of view.

If you want to allow your users to customize their WordPress-MU themes, the first thing you need is UserThemes Revisited.  You can download the plugin here.

Before you install the plugin, I would recommend making a few changes.  In it’s unedited state, the plugin allows your users to access both PHP and CSS files.  Offering unrestricted access to PHP files means that you are risking the possibility of malicious code being ran on your server.  Let’s block PHP files from being edited:

Open up /wp-admin/theme-editor.php – under the line that begins with $parent_file,  insert the following code:

if((get_option(‘ut_use_user_theme’) != 1) || (get_option(‘ut_enabled’) != 1))

{

wp_die(‘Either you have not been granted permission from the site administrator to access the theme editor OR you do not have a usertheme as your active theme, theme editor will die while a system theme is active.’);

}

ds_redirect_theme_editor();

Look for this line:

$allowed_files = array_merge($themes[$theme][‘Stylesheet Files’], $themes[$theme][‘Template Files’]);

Comment it out, and insert this below:

array_merge($themes[$theme][‘Stylesheet Files’],$themes[$theme][‘Stylesheet Files’]);

Next, open the file /wp-admin/includes/mu.php and comment out this line:

unset( $submenu[‘themes.php’][10] );

Now it’s safe to upload and install the UserThemes Revisited Plugin.  Your users should see a screen like this one, which allows them to create their own copy of a theme they want to edit.6545_04_utruser1

Once they’ve made a copy of a theme, they can edit the CSS files using the theme editor.

6545_04_utruser2

For your convenience, you can download the edited versions of the core files here.


Simple Stats – Visitors Online

This post is designed to accompany Chapter 3 of my book, the WordPress-MU 2.7 Beginner’s Guide.

Would you like to show some simple stats in the sidebar of your WordPress-MU site?  Something like the stats in the screenshot below?

Visitor Stats

Visitor Stats

WordPress-MU makes it easy to pull information about the number of blogs and users that your site has, and display that information on the page, just use something similar to the following code.

<li id="Stats">
<h2>Site Stats</h2>
<ul>
<li><?php
$stats = get_sitestats();
echo "MYSITE.com currently has
<b>".$stats[ 'blogs' ]."
</b> blogs and
<b>".$stats[ 'users' ]."
</b> users."; ?></li>
</ul>

The above code will display the number of blogs that have been registered, and the number of user accounts that have been created.

If you’d like to show the number of visitors currently online, there are a number of ways you can do this.  The easiest is to use a simple visitor tracking script that will keep a count of recently active sessions.

Download this Simple visitor tracking script (right click and save as, then re-name the file to vonline.php).  This is a slightly edited version of a script that I’ve been using on my sites for a couple of years.  I did not write it, if anyone recognizes it, please let me know in the comments so I can give credit to the original author.

Upload the vonline.php file to your site (for simplicity, let’s pretend you put it in the same folder as your sidebar.php file – if you put it somewhere more central, then you will need to change the path used in the include statement to reflect that).

Then add the following line to the code listed above (place it just before the </ul> tag).

<li><?php include('vonline.php') ?></li>

Congratulations, now you have some visitor stats on your WordPress-MU blog home page!