generate unique number when registering a user

This will do what you want, and both functions should be placed within your fucntions.php file. The my_random_string() function accepts arguments, so you can add data before/after the string, as well as change the length of the string and the characters that are used to generate the string. /** * Generate a string of random … Read more

How to get the password and username of the add new user form (admin back end) in wordpress

You’ll need three hooks: 1: user_register This is for when the user is created via the admin back-end. The username will be available via $_POST[‘user_login’] and the password will be available via $_POST[‘pass1’]. 2: edit_user_profile_update This is for when the password is updated on the profile page by the user or admin. The username will … Read more

How to use the WP REST API for new user registration (sign up form)?

hopefully you’ve found the answer already. Here’s our solution, for your reference. 😀 The following code should add User Registration via REST API to your WordPress Website. It supports Registration of ‘subscriber’ and ‘customer’. Add it to your function.php add_action(‘rest_api_init’, ‘wp_rest_user_endpoints’); /** * Register a new user * * @param WP_REST_Request $request Full details about … Read more

Changing username after registration to get around the issue of having duplicate emails?

You can try this skeleton plugin: /** * Plugin Name: Allow duplicate emails on registration * Plugin URI: http://wordpress.stackexchange.com/a/125129/26350 */ add_action( ‘plugins_loaded’, array( ‘Allow_Duplicate_Emails_Registration’, ‘get_instance’ ) ); class Allow_Duplicate_Emails_Registration { private $rand = ”; static private $instance = NULL; static public function get_instance() { if ( NULL === self::$instance ) self::$instance = new self; return … Read more

How to override WordPress registration and insert an auto-generated username?

One alternative is to modify the $_POST[‘user_login’] input value when submitting new registration form, that is before WP process the registration form. A good hook to achieve this is login_form_register that fires before processing and rendering registration form. login_init also works but need more work to make sure we are on register action. add_action(‘login_form_register’, ‘custom_user_login’); … Read more