I want to give every new registering user a unique key apart from the password field and other fields in the WordPress database table for external use. I want to use this key for identification of every registered user in my app. SO that the user in this database also use the app. Please, anyone, help me to create a unique key for every user in WordPress.
I will get this key using this /
I want to give every new registering user a unique key apart from the password field and other fields in the WordPress database table for external use. I want to use this key for identification of every registered user in my app. SO that the user in this database also use the app. Please, anyone, help me to create a unique key for every user in WordPress.
I will get this key using this http://wordpress/wp-json/v1/authorization/
Share Improve this question edited Jul 18, 2019 at 7:41 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Jul 17, 2019 at 13:20 packers5thinGurgaonpackers5thinGurgaon 11 bronze badge1 Answer
Reset to default 0I think you may try user_register hook for this purpose, because it gives you user's id, which you need to add user meta.
According to WP documentation:
This action hook allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument.
add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
function myplugin_registration_save( $user_id ) {
/*
Create your **$unique_key** here and add it as user meta below
*/
update_user_meta($user_id, 'unique_key', $unique_key);
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745313484a4622108.html
评论列表(0条)