I am running a multisite wordpress install alongside two other opensource applications (Elgg and a made-from-sratch project management system built on CodeIgniter), but each has its own user system, authentication, etc. I am merging these three to use the same user login system so that my users can login once for all aspects of the site, and I don't have to have all userdata in three different places. I've mapped out the databases, and already remade the CodeIgniter system to use the Elgg user authentication.
WordPress is next. My thought was to extend the wpdb class so that anytime a query is run on the $wpdb->user or usermeta tables, it runs my custom methods that extract the user info from the Elgg system and returns it in wordpress terms. Then all I need to do is have the master login script set the appropriate wordpress cookies and my user logs in once for all three systems.
Is there a way to do this with by coding a plugin? I'd rather not hack the wpdb class. I've seen a few mentions of db.php being used to extend the class, but I can't find documentation about how this actually works.
Or, if anyone knows a better way to go about this, I'm all ears.