What i'm trying to do is to share the users credentials between 2 or more Wordpress installations on the same database. I read many tutorials, and forums on this one but none gave me a clear answer on this one. So according to Wordpress Codex ([1]), all I have to do is add the code below to wp-config.php (child installation) in order to switch tables for users and usermeta:
define( 'CUSTOM_USER_TABLE', 'main_users' );
define( 'CUSTOM_USER_META_TABLE', 'main_usermeta' );
This allows me to login with the root sites' username and password but I'm getting the message
You do not have sufficient permissions to access this page.
Then I'm completely lost. I checked the _capabilities inside the database as stated at [1] but still getting that message.
Any help would be really appreciated since I'm working on this one for 3 days. Thanks!
[1] http://codex.wordpress.org/Editing_wp-config.php#Custom_User_and_Usermeta_Tables
This is not quite the right way to go about it. If you succeed with this, I think you'd be opening yourself up to some serious security vulnerabilities.
Instead, you should look into creating a WordPress Multisite install. The details of Multisite are here: http://codex.wordpress.org/Create_A_Network
You can also learn more about Multisite here: http://mashable.com/2012/07/26/beginner-guide-wordpress-multisite/
Trying to get two separate installs to share information isn't the normal way to attack this problem... most of the times with this requirement, I've seen people use Multisite.
Solution :
Our goal is to set up two WordPress websites which will share logins and the same users. Once a user has subscribed one
website, she would be able to access the other website with the same role and capabilities.
step 1: In order to share the same users and usermeta tables, WordPress installations must share the same database. add prefix of first wordpress installation first_ and second wordpress installation table second_. in same database.
step 2: When the first WordPress website is up and running, we can edit its configuration file. Open /first/wp-config.php
and add the following lines above the ‘stop editing’ comment:
step 3: We are done with the first installation. Next we have to copy wp-config.php from the first installation folder and
paste it into the root folder of the second installation. Be careful to change the $table_prefix value accordingly:
open /second/wp-config.php.and add the following lines above the ‘stop editing’ comment:
step 4: write in both wp-config.php for sharing cookies.
step 5: Open table "first_usermeta" and copy from column meta_key - first_capabilities and first_user_level to the second_capabilities and second_user_level.
step 6: When running the second installation, we should set a non-existent email address for admin user as WordPress finds a number of existing users from first_users table.
For more Detail https://kinsta.com/blog/share-logins-wordpress/.
It's work for Me.