register a user (programmatically) multisite, on the signups table
-
Hello everyone, I face this difficulty in a multisite plugin I develop and I need your help, if you please.
I’m building a front-end form that allows a user (with the proper permissions) to create another one. For that, I use the hook admin_post_ {my_function} and my_function is supposed to do the registration work after receiving the necessary information in POST.
I have found many ways to do this registration but I have not found the right one ??
What I want for my front-end: I’d like that an authorized user could “pre-register” a new user, in the ‘signups‘ table, with a temporary password (either received by the form or generated by wordpress), that is the common way to register a new user in the admin part of WP. (the temporary user stays in the “signups” table until he receive a mail, log on, change his password, and then, be transfered to the “users” table).
I found several possibilities but none of them does exactly this:
1 – I have tried with wp_create_user ($ username, $ passwd, $ email): it works but it creates a user directly in the users table. Then, we can assign a role (with the created $id) and we can send a notification with wp_new_user_notification ($ username, $ passwd)
2 – I have tried with register_new_user ($ username,$email): it’s almost the same, except that WP creates a passwd.
3 – We also could use wp_insert_user($ args), as it offers a good list of parameters arguments, but none offers the possibility to choose ‘temporary’ or something like this.
I probably miss something important…Would you know a way to make this ?
(I have tried to read the wp-admin/user-new.php in order to mimic it, but I got rapidly lost !)thank you in advance for any help…
Pierre
- The topic ‘register a user (programmatically) multisite, on the signups table’ is closed to new replies.