Multiple WordPress Blogs using One Login
-
I’d like to have 2 or more installations of wordpress in the same database that all share the same login — so the user registers once and can login to any of the blogs using that one login.
In other words, I’m talking about integrating 2 WordPress blogs into using a common login. It seems simple enough — I have an idea of how to do it but I’m a hobbyist programmer and there may be problems I haven’t anticipated. It seems like an idea someone else would have already come up with and solved.
Would the following approach work?
1. In the config file, add a line to define a table prefix for the table(s) used for users and the login. This is in addition to the line already there for ‘table_prefix’.
$table_prefix = 'wp_';
$table_prefix_login = 'wp_';
2. Then go through all the wordpress files using search/replace, find any code referring to the user/login table(s), and replace
$table_prefix
with$table_prefix_login
. Now the user tables are defined separately from the other tables.3. Install this new version of wordpress 2 or more times into the same database using a different prefix for each installation:
In mainblog config file:
$table_prefix = 'mainblog_';
$table_prefix_login = 'mainblog_';
In 2ndblog config file:
$table_prefix = '2ndblog_';
$table_prefix_login = '2ndblog_';
4. After they are installed and tested, in the 2ndblog’s config file, change the second line so it uses the mainblog’s user tables:
In 2ndblog config file:
$table_prefix = '2ndblog_';
$table_prefix_login = 'mainblog_';
Would that work?
- The topic ‘Multiple WordPress Blogs using One Login’ is closed to new replies.