简体   繁体   English

用户在WordPress中注册时更新自定义表

[英]Updating custom table when user registers in WordPress

I am looking around the code in WordPress and not sure where to look and how to complete what I am doing. 我正在查看WordPress中的代码,不确定在哪里查看以及如何完成我的工作。

I have a custom table in Wordpress that I have created, lets call it MyCustomTable. 我在创建的Wordpress中有一个自定义表,可以将其称为MyCustomTable。 I have some data that I want to insert in to a table when the user registers. 我有一些要在用户注册时插入表中的数据。

I want to add an ID this is auto increment and done by the table so not a problem, and want to also add in the userid and a hardcoded user group. 我想添加一个ID,它是自动递增的,并且由表完成,所以这不是问题,并且还想要添加userid和一个硬编码的用户组。

So when user registers the following is passed to the database. 因此,当用户注册时,以下内容将传递到数据库。

INSERT INTO MyCustomTable
VALUES (this will be autoid so not needed in insert, UserID ,Hardcoded membergroup);

Where or how to do this? 在哪里或如何做?

Use the user_register hook for the trigger. 使用user_register钩子作为触发器。

If you need help with custom queries, look here 如果您需要有关自定义查询的帮助, 请点击此处

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM