Wordpress MU as a Social Networking Platform

Last month whilst setting up my wordpress mu domain parking system, I came across Andy Peatling’s post about how he pulled together a bunch of plugins and hacked away at wordpress mu until he came up with a working social network that he used for his college girl site chickspeak.

chickspeak

It’s pretty neat reading about other hackers exploits and seeing the fruition of their works. ChickSpeak looks awesome - the design really fits in with it’s girls diary marketing. The plugins that Andy wrote for this included photos, private messaging, extended profiles, polls, and user credentials. He also integrated bbpress as the forum for members to hang out.

Since ChickSpeak’s launch, Andy has extended this to create BuddyPress which is intended to be a full scale wordpress mu social network platform for public release that we can all use (ie. it’s not just hardcoded for chickspeak). BuddyPress was quickly snapped up by the Automattic Wordpress gang (especially since they’ve just raised millions in VC funding!) and Andy has joined the Automattic permy staff team.

buddypress

Today, the official BuddyPress.org website is finally live. The code source is still very much in it’s infancy and it’s no where near usable but it’s feature list look very promising…

  • Extended Profiles: The extended profile component allows site admins to create specific profile fields for their members to fill in. They can create as few or as many profile fields as they like, be as specific or vague as they want. Profile fields can then be grouped…
  • Personal Blog: This is everything WordPress has to offer for publishing a blog. The only difference is that all administration tabs will be moved underneath a “Blog” tab…
  • Private Messaging: BuddyPress private messaging works like internal site email. Members can message people on their friends list as well as forward and reply to received messages…
  • Friends: Members of a BuddyPress social network can be connected together by one member adding another as a “friend” and then the other member accepting the friend request…
  • Groups: Groups in BuddyPress are a gathering of members, blog posts, photos and any other user generated content…
  • The Wire: This is a place where friends can come along and post to a members profile. This would be a short message and could include a picture and some basic HTML. The TinyMCE editor will be used to allow for basic formatting…
  • Status Updates: Status updates in BuddyPress will appear on a member’s profile page. A member can update their status as frequently as they want to. All status updates are logged in a member’s activity log…
  • Albums: Members of a BuddyPress installation will be able to create their own photo albums. These albums can be shared with friends and groups. Each member is given a certain amount of space, which can be set by the site administrator…

so basically, this will be the open source version of myspace.. but much much better, cleaner, faster, friendlier! I’m a big fan of this and will definitely be watching this space. I’ve always thought that if you can somehow combine the blog, the forum, and the social networking, you could create a really addictive service. MySpace was v1.0 and BuddyPress is definitely shouting v2.0. Let’s hope it can live up to the hype cos I’ve got the perfect domain name to maximise on this platform - muhahaha :P

Extra info: You can keep up with Andy in his data stream page: Andy in Life

Popularity: 13%

Wordpress Mu 1.3.3 released

Wordpress 2.3.3 was released over 25 days ago as a ‘urgent security release’. Unfortunately it’s taken this long to get the mu branch of it updated by the Auttomatic team. I tried just copying the wp 2.3.3 over my mu install but obviously that doesn’t work.

Link: Download mupress 1.3.3

For me the major fix was adding the ‘permalinks’ option back in the admin panel. I’m not sure if I was just blind or what but I swear it wasn’t there in v1.3.2. Now I can finally get rid of the dates in my permalinks!

For the upgrade, all I did was

  1. copy over the files
  2. Log into Site Admin
  3. Hit the Upgrade button to update the database schema

easy peasy. I didn’t bother about deactivating & reactivating my plugins or taking a backup… such is my trust in the wordpress platform :)

Popularity: 7%

How to make the Sitemap Plugin work for Wordpress mu

The next logical step after getting wordpress mu to work with multiple domains is to tell google all about your sites via google compliant sitemap.xml files. If you’re anything like me, you would have searched through the mu forums and come out more confused than what you started with. There’s about three attempts to make a mu plugin over at wpmudev.org and they all fail dismally. This is so not typical of wordpress as normally, there’s a plugin developed for just about anything you can think of. With such a gap in the mu works, I’ve had to hack my own sitemap plugin to get my domain parking mu working. Luckily, Arne Brachhold’s plugin for the normal wordpress is very nicely coded and has all the bells and whistles that you’d ever what a sitemap plugin to have.

The first problem with Arne’s plugin is figuring out where to put the sitemap.xml since you have so many blogs running off the one wordpress. If you put it in your root directory, it will be overwritten by every blog as they are all pointing to the same location. The first hack is to default the location of the output to each blog’s individual upload folder (ie. /wp-content/blogs.dir//files/) and to create it if it doesn’t exist already (wordpress only creates the upload folders the first time you try to upload something)

Edit the InitOptions() function in the sitemap.php file


//JH brute force - set the sitemap location to manual mode
$this->_options["sm_b_location_mode"]="manual"; //Mode of location, auto or manual
//workout what the upload directory for this blog is
$upload_dir = ABSPATH . UPLOADS;
//create the directory if it does not already exist
wp_mkdir_p($upload_dir);
//preset the manual directory and url
$this->_options["sm_b_filename_manual"]= $upload_dir . "sitemap.xml";
$this->_options["sm_b_fileurl_manual"]= trailingslashit(get_bloginfo('siteurl')) . "sitemap.xml";

Next we want to force it to output a robots.txt file every time so that the search engine spiders know where to find the sitemap. To do this we set the robots flag to true in the same initOptions function.
$this->_options["sm_b_robots"] = true;

There is also a bug in the GetRobotsFilePath() function in that it is not putting it in the same location as the sitemap path. Another dirty hack is needed:

function GetRobotsFilePath() {
//return trailingslashit($this->GetHomePath()) . 'robots.txt';
//JH brute force
return ABSPATH . UPLOADS . "robots.txt";
}

That’s it for the sitemap.php file.

The next hack is to wordpress itself. Wordpress mu is only up to v2.3.1 of wordpress and there is a bug in one of the functions to write to a file. Whilst we are waiting for mu to update, this silly line needs to be commented out from one of the functions.

function insert_with_markers( $filename, $marker, $insertion ) {
//return;

Yep, that’s exactly right. Someone’s put a return statement as the first line of code so that this function exits straight away without actually creating and editing the file. This function is used to create your .htaccess file and the sitemap plugin reuses it to write your robots.txt

We’re almost there. Google doesn’t like your sitemap.xml file to be anywhere except your root directory. It is currently sitting in http://yourblog.com/files/sitemap.xml and we want to actually trick google to see it as http://www.yourblog.com/sitemap.xml. To do this, we need to edit the .htaccess file on your root directory:

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]
#sitemap
RewriteRule ^sitemap.xml$ wp-content/blogs.php?file=sitemap.xml [L]
RewriteRule ^sitemap.xml.gz$ wp-content/blogs.php?file=sitemap.xml.gz [L]
RewriteRule ^robots.txt$ wp-content/blogs.php?file=robots.txt [L]

Those three lines under #sitemap will redirect calls to the files to your blogs upload directory. The blogs.php file is mu’s handler to redirect to the right blog directory depending on what domain you are accessing.

Phew that’s it! Hope I didn’t lose anyone. It could have been a bit cleaner but it’s a hack specifically for my wordpress mu so it doesn’t need to be pretty :) All that there is to do now is to login to your wordpress, enable plugins for your blog, activate the sitemap plugin and generate your first sitemap.

O. And when you submit your sitemap to google’s webmaster tools, you should use the meta tag option to verify your site rather than the file option. This avoids having hundreds of google2143293udsf0.html files in your root directory. An easy way to do this is the Add Meta Tag plugin. Remember, both the add Meta Tag plugin and the Sitemap plugin go in the wp-content/plugins directory as they are just normal wordpress plugins.

Update 26/6/2008: I’ve finally gotten some free time to clean up this hack and upload it so that you don’t have to edit the code anymore. Download it here on my new bitminds software site.

Popularity: 26%

Multisite Manager with Wordpress MU

I’ve been looking for a way to simplify the process of setting up new websites. Wordpress does a great job in that the install process is quite simple and I can get one up and running in about 10 minutes. The trouble is whenever there is an update, I have to go to all my sites and manually upgrade them all (Fantastico does a great job of this but my web host is a bit slow in updating their wordpress versions in fantastico.)

Enter Wordpress MU (multi user). This is basically the version user on Wordpress.com where millions of people have their blogs hosted. It is absolutely amazing that these guys have released it open source for general public use. The best thing about this is that everything is on one database, and one code set - ie. I will only need to update it once when there is a new version.

However, by the default, wordpress mu only works on subdirectories (ie. domain.com/blog1) or subdomains (ie. blog1.domain.com) so a little tweaking needs to be done in order to get it to host different domains (eg. blog1.com, blog2.com, blog3.com, etc.). As is customary for wordpress, everything has a plugin already developed. In this case, you need to down the multi-site plugin for wordpress mu. Unfortunately, there’s absolutely no documentation that comes with this - they don’t even tell you were to upload the plugin! Hopefully, the rest of this post will help other people out so they didn’t have to go through all the trial and errors that I went through.

Installing Wordpress MU:

  1. Download the latest version from mu.wordpress.org
  2. Upload it to the root of your public_html or www domain directory. I’m guess you should also be able to put this in a subdirectory (eg. domain.com/wpmu) but since it’s going to host a ton of other domains, lets put it in the root so we don’t over complicate things.
  3. Create a new database (eg. wpmu). Most people have cpanel so this is done via the MySQL databases link in the cpanel admin page. You will most likely be on a shared hosting account so your db will be called something like username_wpmu.
  4. Create a database user for wordpress to use. Most people will call it the same as the db name so it is easy to match them up. Remember to add the user to the db and grant all permissions.
  5. Try to access your domain in the web browser. The wordpress mu install page will come up and tell you what is missing. This will be stuff like changing the permissions of some files, giving it the access rights to the database, etc. It’s pretty self explanatory and I didn’t have any problems at all.

Installing Multisite Manager

  1. Download the latest plugin from http://wpmudev.org/project/Multi-Site-Manager
  2. Uncompress the file and upload it to the wp-content/mu-plugins directory
  3. That’s it. You should now be able to log into your wp-admin and see a ’sites’ page in your site admin screen.
  4. multisite site admin

Adding a new site

  1. Firstly, you need to add the domain to your hosting account. Log into your cpanel and add a parked domain.

    parked domains

    ( Obviously, you need to also make sure your domain is using your hosts nameservers at your domain registrar. )

  2. Now here’s where the money is. Instead of adding a new blog, you go to the site admin and add a new site (ie. your new domain)
  3. Apart from the new domain name (use domain.com, instead of www.domain.com!) , I’ve circled all the bits you need to fill in.

    multisite add a site

  4. Path: You can’t leave this blank. Put in a slash
  5. Clone Site. You MUST select your main domain to clone. This is so that every site can have it’s own site admin and be able to manage the themes and plugins.
  6. Leave everything ticked (selected) but also check the site name and illegal names boxes. ( It doesn’t seem to work properly without these cloned. )
  7. You should now be able to log into the wp-admin of your new domain. (ie. newdomain.com/wp-admin)
  8. Once logged in, go to the Options menu and update your Site Name and tag line
  9. Also go to the Presentation menu and pick the theme that you want the new site to use. If the theme isn’t there you will need to go to the Site Admin menu and enable to theme.
  10. That’s it. You’re ready to go. All the other menus are the same as the ordinary wordpress.

Once you have Wordpress mu setup, you basically have your own domain ‘parking’. I have a theme fully loaded with adsense and every time I have register a new domain, I just ‘park’ it and it’s ready to go. This is sooo much better than those traditional parking companies. It’s almost like parking on steroids because I can put whatever I want on the site, I can build as many backlinks as I want, and it will almost definitely get indexed by google.

Parking domains with wordpress mu is what I do now for all my domains until I find the time to build them into a proper site. It’s working really well because now I’m not missing out on any money by having domains sitting empty. Check out SEOpinions and Media Leaks as examples. They’re both running off FreeServing.com but they are functioning as completely separate installations! Thank you Wordpress!!

Popularity: 49%