简体   繁体   English

新表字段上的Wordpress user_login字段

[英]Wordpress user_login field on new table field

I am using wordpress and I've created a new table in the wordpress database. 我正在使用wordpress,并且已经在wordpress数据库中创建了一个新表。

I have created a new table which contains a userid field 我创建了一个包含用户标识字段的新表

My question is, is there anyway to make a copy save/sync wordpress's user table user_login field into my new table so that every time there's a new user my table is also populated with the user_login field? 我的问题是,是否有将wordpress的用户表user_login字段保存/同步到我的新表中的副本,以便每次有新用户时,我的表也都填充有user_login字段?

Well, to make a one time copy of the user_login field into your new table, you would do this: 好吧,要将user_login字段一次性复制到新表中,您可以这样做:

insert into new_table (user_login)
select user_login from UsersTableNameHere

Warning: adjust script accordingly with table and column names, since and do not know WordPress DB structure, neither your new table's structure. 警告:请使用表和列名相应地调整脚本,因为并且不知道WordPress DB结构,也不知道新表的结构。 Also, make sure your user_login column has the same (or compatible) data type as user_login in the original users table 另外,请确保您的user_login列具有与原始users表中的user_login相同(或兼容)的数据类型

Now, if you want to replicate the user_login automatically whenever a new user is created, you should look into creating a trigger. 现在,如果要在创建新用户时自动复制user_login ,则应考虑创建触发器。

Read those on how to create a trigger: 阅读有关如何创建触发器的内容:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WordPress 数据库错误:[表 'databasename.wp_users' 不存在] SELECT * FROM wp_users WHERE user_login = 'Username' - WordPress Database Error: [Table 'databasename.wp_users' doesn't exist] SELECT * FROM wp_users WHERE user_login = 'Username' 用户单击链接时如何在表中创建新字段 - How to make a new field in table when user clicks on a link Laravel 5.2在登录时检查用户字段 - Laravel 5.2 Checking user field on login WordPress登录名(用户标识)和特定表数据 - WordPress Login (User ID) & Specific Table Data 如何将wordpress mysql md5用户密码字段转移到另一个mysql表中 - How to transfer wordpress mysql md5 user passwords field into another mysql table 如何将表的修改字段复制到同一表中的新字段? - How do copy a modify field of a table to a new field in the same table? 如何在与现有字段(表的另一个字段)有一些偏移量(表的字段)的视图中创建新字段? - How to create new field in view with some offset (field of table) from existing field (another field of table)? 在自定义WordPress数据库表中的文本字段中添加新行,而不会覆盖现有值 - Adding a new line to a text field in custom WordPress database table without overwriting the existing value MySQL:多值字段与新表 - MySQL: Multivalued field vs new table 更新数据库结构-新表或添加字段 - updating db structure - new table or adding a field
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM