Share users between two blogs.

Ever needed to create a main wordpress site with a subdomain (also wordpress site) but wanted to use the main wordpress sites’s mysql database and  user table?

Well here’s how..


The rule here is to have two different sets of prefixes (ex. main_ for the main site and sub_ for the subdomain site)

Put them both in the same database with different prefixes. Then choose one of them to be the master user table. Then do this in both wp-config.php files:

define(CUSTOM_USER_TABLE,’main_users’);
define(CUSTOM_USER_META_TABLE,’main_usermeta’);

Note: default prefix is “wp_”.. we just used “main_” as an example and you can use any other prefix you prefer.

In other words, you designate the user table from ONE installation as the master user table which will be used by the other installations instead of their own user table. This PHP code must go in the wp-config.php file in all the installations that you want sharing a single user table. You can have more than two installations set up the same way. Their tables must all be in a single database however.

For this to finally work.. you need to

in table wp_usermeta look for the following entries, at least for the admin account:

main_capabilities – a:1:{s:13:”administrator”;s:1:”1″;}
main_user_level  - 10

create the following records for the same user..

sub_capabilities - a:1:{s:13:”administrator”;s:1:”1″;}
sub_user_level - 10

disclaimer: This should only be done if you are familiar with and have phpmyadmin on your site or if  you are sure of your SQL. always back-up your database before trying anything.

Related posts:



Services
  • PSD Conversion

    Need a design mockup converted into a functional WordPress theme? We can help! We specialize in slicing and dicing custom mockups into fully functional WordPress themes. The custom designed theme will also utilize all current WordPress features, like m...

  • Wordpress Websites

    Need a WordPress website? We can help! At ETN Multimedia we offer complete website solutions. We put our creativity, originality, and years of expertise to work to design the perfect WordPress website for you. Already have a WordPress website? Ca...

  • Web Design

    Web Design For the budget conscious, we offer basic, simple and static web pages coded in basic HTML, CSS and for a little dynamicity, javascripting. Please feel free to go over our web design packages. We create static web sites based on client ...

  • Web Maintenance Services

    Some corporate websites do not require a major overhaul, but instead require some kind of maintenance with regards to content and basic layout. We are more than qualified in offering regular maintenance and updating services to our clientele. Aside ...

  • Online Application Development

    Dynamism, that is the key on the today's online business, and as anybody can see, that is the future of Internet. If you want create to a dynamic online services like dating site, online shopping platform, social network platform to the World Wide ...

  • Web Development

    People often misunderstand the differences between web development and web design; these are two completely different things. Web development is in charge of the structure of the website, this is the behind the scenes operations, it is where all the c...

  • CMS Solutions

    Modern style editable web solution Having the ability to quickly and easily update your website empowers your organisation to have a highly dynamic online presence. At ETN MultiMedia, we understand that every organisation has different requirements ...

FREE CONSULTATION!
A member of our team will get in touch with you within 24 hours.

Your Name (required)

Land Phone (required)

Mobile Phone

Your Email (required)

Subject (required)

Budget (required)

Your Message

Partners