How to add a login form to a Wordpress site, linked to another site

CSHTech
CSHTech used Ask the Experts™
on
I need to create a login form on a business website, that will link to the login details/database that are actually held at another site, so that people can login using either site.

I know that I can add a link in the (newer) business website which redirects to the other site's login page so that people can login there, but is there a way of creating a login in the newer site, which goes directly to the other site's database?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Is the other site also a Wordpress site?  If so is the MySQL DB on the same server?

Author

Commented:
I believe so, yes to both.
Commented:
You wouldn't want to copy over that user table from DB1 to DB2 although that would solve it temporarily but then you would have issues updating one DB and not the other.  Plus there are security issues with that.  

It sounds like you want WP1 site and WP2 site to pull from only the DB1 User table only and ignore the DB2 User Table.  Yet WP2 still has to look at all other DB2 tables (Posts, Pages, etc) but somehow ignore the DB2 User table?  

That is some serious PHP and MySQL coding that those forums might be able to help you with.
Jason C. LevineDon't talk to me.
Commented:
Depending on how handy you are with breaking into the WordPress core files, you might be able to do this via a UNION query/view on the users table from site A and site B to create one master table of users.  You would then hack wordpress to compare login attempts against the View instead of the default table.

While this is theoretically possible, I'm not at all sure it's going to work in practice.  You would have to somehow deal with the user_id, which is a simple auto-incrementing value but used by each installation of WP to do various things.  Pulling external records in sounds like a recipe for disaster as different people could have the same ID depending on which site they are coming from.

You may want to look seriously at WP in multi-site mode instead.  That would let you deploy multiple sites off of one install but use a common user table for login purposes.

Author

Commented:
Thanks for your help.

You've confirmed that it's probably too complicated as it stands and I'll think of another way! :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial