I'm working on a plugin for a system to use Wordpress as the authentication backend, so that I can use my existing Wordpress users in another application. The plugin works great when running in single website mode:
include /path/to/wordpress/wp-config.php
global $wpdb;
// SQL and code to select user and compare entered passwords
I need this to work against a Wordpress Multisite install as well. When I pull in the wp-config.php for the MS site, I end up with this error:
Fatal error: Call to a member function set_prefix() on a non-object in /path/to/wordpress/wp-includes/ms-settings.php on line 126
On line 126, WP is trying to set the table prefix against $wpdb, but for some reason $wpdb doesn't exist here. I ran xdebug and $wpdb does get created, but ms-settings.php doesn't see it. I can fix this by adding:
global $wpdb;
right before line 126 and it works, but I don't want to modify the core Wordpress code. Is there a better way to bootstrap Wordpress ?
