开发者

creating default set of users for a new site

开发者 https://www.devze.com 2023-01-04 04:35 出处:网络
I will be creating numerous sites. Each site will have default users. These users are content creators i.e. having the ability to add and e开发者_StackOverflow社区dit pages.

I will be creating numerous sites. Each site will have default users. These users are content creators i.e. having the ability to add and e开发者_StackOverflow社区dit pages.

I want to save time by not having to recreate these users manually for every new site. Is there a way to do this?


Yes. Use a shared user table:

http://codex.wordpress.org/Editing_wp-config.php#Custom_User_and_Usermeta_Tables

You should make one site the 'main' site. Then, whenever you make a new site, use the same database, but CHANGE THE PREFIX for each one. Then, define CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE in wp-config.php so that it looks at your 'main' site's user tables. For example, say your main site is set with a database prefix of site1_, you would then, for site2_, add this to the wp-config.php file:

define( 'CUSTOM_USER_TABLE', 'site1_users' );
define( 'CUSTOM_USER_META_TABLE', 'site1_usermeta' );


Jons method will work if you want to share the users at all times, but if you just want to copy them from one to another, the easiest way is to create a SQL backup of the wp_users and wp_usermeta tables in phpmyadmin and then import them into each successive wordpress install.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号