Thursday, April 08, 2010

Drupal 6 multi-site single sign-on

I've just spent the last two days looking into setting up single sign-on across multiple sites under a shared domain. I looked at both the Multisite Login and Single sign on modules but in the end the solution was achieved without either of these modules. Multisite Login correctly notes in the README : "if you are using several sites on the same domain then you do not need this module. The multisite functionality in Drupal core has the ability to share logins for sites like these without additional modules." The problem was there doesn't seem to be much documentation about achieving this. In the end the solution was on Eric's Drupal Blog but it was sort of lost in the detail so I want to note the key elements here.

For this example we have three sites,, I want to be able to sign on to one site and to be signed in to all.

Start by setting up the master site as you normally would (if you haven't set up a multisite before this earlier post may help). The only additional thing to do is to set the cookie_domain variable in the sites settings.php:

$cookie_domain = 'master';

Now go ahead and setup slave1. Once again add the cookie_domian (using the same value as the master site) but this time also define the db_prefix array. You use this to tell this site to use the database from the master site for some of the tables. Lets say that the master site uses a database called masterdb. To tell slave1 to use this database for the users table add 'users' => 'masterdb.' to the db_prefix array. The exact list of tables you'll need to add will depend on how much functionality needs to be shared across your sites. Eric's post adds users, sessions and authmap. I've also added filters, filter_formats and role :

$db_prefix = array(
'default' => '',
'access' => 'masterdb.',
'authmap' => 'masterdb.',
'filters' => 'masterdb.',
'filter_formats' => 'masterdb.',
'role' => 'masterdb.',
'sessions' => 'masterdb.',
'users' => 'masterdb.'

Now you are ready to install slave1. When that's done you should be able to log out of and into either site and stay logged in across both. Repeat the steps used for slave1 on the slave2 site. That's all there is to it. In essence all that's required is to share some core tables and the cookie domain across all sites. The only problem I struck was if the cookie_domain isn't an actual domain.

Monday, July 27, 2009

New Game : Balance Of Power

After many months of hard work and heartache my latest game Balance of Power is finally available. This game is a real departure from my last two games Wheel of Death and Perpetual Motion (both using the Box2D physics engine). Balance Of Power is a turn based strategy game. While most games are about resource depletion : a resource called health. Balance of Power is about resource distribution : a resource called influence. The more influence you have the greater your status. The higher your status the more influence you can take. The aim is to take all the influence from the enemy. When their influence is gone they will start to see things your way.

It's probably not the easiest game in the world. But like many board games it rewards the effort of learning a few basics with many hours of challenge. I actually built most of Balance prior to starting the physics based games. But I felt that it's genre would be an obstacle to it's success. In the end I came back to it and decided I really liked the game and so committed to getting it published regardless. I hope that you will give it a fair go as I think it will be worth your efforts.

Thursday, July 16, 2009

RSS vs Twitter

Like a lot of people I started out very sceptical about the value of Twitter and have gradually been drawn in. I'm finding more and more useful ways to use Twitter. I don't really get the desperate pursuit of followers but have found very real value in following a small number of reliable streams. For example, I can't imagine that I would ever stop following abcnews. But I'm still very attached to RSS through Google Reader and still defining the line where something works as a Tweet rather than an RSS. For example, I still find myself following TechCrunch on both Twitter and via RSS. Twitter offers convienience while I'm still very keen to star and share things in Google Reader. Anyway I just found a very clear example of something that works much better in RSS than in Twitter : Dilbert. I can't start the day without a dose of Dilbert. Below are two screenshots the first from Google Reader and the second from Twitter. However you look at it the Reader version is handy and the Twitter version (even with the preview addon) isn't:

Saturday, April 25, 2009

The Reid iPhone Reader

A growing category of iPhone apps is the eReader. Obviously they aren't as common as games and fart jokes but they are a lot more useful. Though I imagine many wouldn't consider the idea of reading books on the iPhone. Some of this is just nostalgia (the smell of the book etc) and some has to do with a poor experience trying to read on a computer screen. But I've read a few books using Stanza (my review) and I'm so taken with the experience that I've told my family not to give me an paper books until further notice. The iPhone's small screen actually seems to assists with reading and I've had no trouble reading chapter after chapter (when time allows).

The latest eReader is Minions Reid. Reid offers three unique ways of reading documents:
  1. Word highlighting
  2. Word Flash : also known as Rapid Serial Visual Presentation (RSVP)
  3. Un-assisted reading (OK this isn't unique)
Of these RSVP (not to be confused with a popular dating site) is new to me and I'm intrigued by it. Essentially the words flash onto the screen one at a time. Hence reading is easy and it's is the progression of words that provide context. A slider allows you to control the speed of the text and hence the speed at which you read. It is very easy to stop the progression of text if you need to pause and do something else. Though I found it hard to go back and re-read a sentence if I wanted clarification.

These features were developed based on usability studies and Minions provides information on the science behind Reid.

To my mind the stand out feature of the Reid is it's ability to connect to and import from your Google Docs. Consequently any text document that can be loaded into Google Docs can be read using the Reid. Readers like Stanza allow you to connect to a range of existing online book stores. Some of these sell the books (ie Fictionwise) but others provide access to free books (ie Project Gutenburg). This provides quick access to an enormous range of books and so far I haven't had any trouble finding something I was keen to read. Unfortunately I've never successfully loaded a work document into Stanza (apparently it is possible). Reid bridges this gap. Any document that is sent to you, that you create, that you find online and that can then be loaded into Google Docs is available. This is something I will definitely use. It annoys me that I will have two readers to cover my needs but I can't see an easy solution to that.

There are a couple of things about Reid that I'm not so fond of:

Firstly, it seems to only store one document at a time. Therefore if I wanted to read two or more things on the way home (where I frequently don't have network access) I can't.

Secondly it provides sliders for adjusting font size and contrast. A slight movement of these sliders seem to take me from 5pt to 50pt and I found it near impossible to get a font size that I was entirely happy with. I also think having these options on the apps menu bar is a bit distracting. Especially as it seems to reload the document after each adjustment. Stanza allows you to adjust the size and appearance through a settings page that provide a preview of the text that updates quickly while you are making adjustments. This seems a much better system to me. I think Reid's approach could work if it was more responsive.

Reid is a genuinely useful addition to the list of available eReaders for the iPhone. It offers some unique reading options and access to your Google Docs. I'd like to see it provide access to a larger pool of documents directly from the app but I will definitely continue to use it and if you need to read documents that you create or that colleagues provide then I'd recommend giving it a go.

Update : In response to my review Michael Coon from Minion has been in touch to say that a few of the issues mentioned above will be addressed in the next version. This includes looking at improving the slider controls and the ability to cache multiple documents.

Sunday, March 08, 2009

Perpetual Motion : Walkthrough

A while back (OK 11 months and 2 weeks ago) my Perpetual Motion game was released. It is now available on 180 different sites and has been played 270,000+ times. It's probably a bit late but now I've finally re-done my website it seemed a good time to publish a walkthrough for Perpetual Motion. It's a bit of a task so I'm publishing one level a day until all 36 are complete (level 8 was published yesterday). If you've never given the game a go, or you got stuck on a level, now may be a good time to have another go.