php Wordpress - 自定义用户Tabl

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Wordpress - 自定义用户Tabl相关的知识,希望对你有一定的参考价值。

<?php

//---------------------------------
//  STEP 1
//---------------------------------
// The two Wordpress installations will share the same database,
// so the following db credentials will be the same in both wp-config files

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'bunttesting_' );

/** MySQL database username */
define( 'DB_USER', 'buntdbu' );

/** MySQL database password */
define( 'DB_PASSWORD', 'Bcre281$' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');



//---------------------------------
//  STEP 2
//---------------------------------
// The two Wordpress installations will share the same secret keys

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'x');
define('SECURE_AUTH_KEY',  'x');
define('LOGGED_IN_KEY',    'x');
define('NONCE_KEY',        'x');
define('AUTH_SALT',        'x');
define('SECURE_AUTH_SALT', 'x');
define('LOGGED_IN_SALT',   'x');
define('NONCE_SALT',       'x');

/**#@-*/



//---------------------------------
//  STEP 3
//---------------------------------
// The most important step!!
// Tell this Wordpress installation to use custom tables for users
// and user meta. These tables should exist within the

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'xy_';

define('CUSTOM_USER_TABLE', 'abc_users');
define('CUSTOM_USER_META_TABLE', 'abc_usermeta');

?>

//---------------------------------
//  STEP 4
//---------------------------------

// You must add user permissions to the second Wordpress site in the user table. 
// Users will have permissions to the original Wordpress install but they will 
// not have access to the newly added Wordpress install by default. For example: 
// the Wordpress site that owns the user table has the database prefix int_
// Users will have an entry in the usermeta table called int_capabilities. For
// the new Wordpress site with database prefix bt_, you will need to add an entry 
// to the usermeta table called "bt_capabilities" for each user you want to give 
// access to. Give meta value "a:1:{s:13:"administrator";b:1;}" for administrator
// priviledges.

以上是关于php Wordpress - 自定义用户Tabl的主要内容,如果未能解决你的问题,请参考以下文章

PHP Wordpress添加自定义用户角色

如何从 PHP 代码自定义 Wordpress DashBoard 中的用户角色?

Wordpress ACF:如何通过自定义代码(PHP)将行添加到附加到用户的转发器字段

Wordpress:在前端检查自定义用户角色

php WordPress插件,用于为WP多站点按站点存储自定义和内置用户字段。适合多语言设置。自定义为y

php 一个WordPress自定义短代码,用于显示wp_usermeta表中的一段用户元数据。依赖Ultimate Member插件