You can use the hook user_register to modify user data upon registration. You can use the function add_user_meta to add custom data to a user. Example:
add_action('user_register', 'add_pin_number', 10, 1);
function add_pin_number($user_id)
{
add_user_meta( $user_id, 'pin_number', $random_number , true );
}
You can look for php function out there to help you creating the random unique number. One idea is to create the number based on the user ID which is already unique.
Related Posts:
- How to display custom user meta from registration in backend?
- ACF Upload Image in front-end with custom form
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- How can I attach a user to another user with user meta
- Creating user without username and password
- Can I add a unique code for each user based on the location?
- Safely changing UserID’s, re-using deleted UserID’s and automatically using deleted userID’s instead of an increment
- Let admin users edit member profiles from front end
- Add custom input field in new user page
- MySQL query to list users who never signed in
- Adding fields to the “Add New User” screen in the dashboard
- Difference between update_user_meta and update_user_option
- get_user_meta() doesn’t include user email?
- Whats the best way to share user data across multiple WordPress websites?
- What the user_status column?
- Problem with Hebrew characters in username
- Remove email verification when new user register
- How to set up User email verification after Signup?
- Allowing an email as the username?
- Grouping users under parent user
- How to create a template for a custom URI associated with the user
- How we can get the user id by its display_name
- WP_User_Query with combined meta query – not working?
- LEFT JOIN, INNER OUTER JOIN, LEFT OUTER JOIN is driving me crazy. Please help?
- How do i auto approve new user?
- How to add follow functionality to multi-author wordpress site?
- Search multiple meta keys at once
- Where to Store Custom User Fields
- Can I hook into the invite user process to verify their email address is from a certain domain?
- Querying Email Addresses for a List of Users with Same Last Name?
- How to customize wp_signon()
- Upload files programmatically to users
- How to add country drop down menu to the user profile?
- Can I bulk register contributors for a new blog
- New user notification doesn’t include activation link
- WordPress to use Drupal users’ credentials
- Add custom fields to the user profile
- stop login if user_status equal zero
- Does wp_delete_user() remove all user content?
- WP User Query fails when searching meta queries and search columns
- How can i create an array user meta?
- Updating user meta
- Creating user in Firebase after WordPress user registration
- Are User Levels Still Currently Used?
- WPML Default Language User Meta [closed]
- Search Users base on meta_value & meta_key
- Displaying different in-page content to cliente/admin
- Can i add password field into my wp registration form?
- get_user_meta an ID for multiple functions
- wordpress disable login for unverified user
- Column Sorting Code on users.php
- Register user when after filling contact form
- Is this code true or not
- Check for valid email after user inactivity?
- User description only displayed for logged user
- The Simple and Correct Way to Add User Meta
- Associate multiple email addresses with the same user account, so they can log in with either
- Send clear password via mail
- how to set default update_user_meta values wordpress
- Get user by meta key – WP multi site
- Cannot Update user meta in custom field
- How to programmatically read the plan text password when user register?
- Can I Create a Second Admin Level User Role?
- Custom registration and pending approval
- Unique password to access a section site
- Make new users automatically approved
- Adding fields to the “Add New User” but the form data not saved into DB
- New User Save Filter
- Assigning multiple or additional capabilities to specific users or how to create additional roles like bbpress roles?
- how do I add role and capability after I create a new user
- What does “link” refer to when you delete a user?
- Edit text of WordPress “Register” button
- set automatically email address for WordPress users
- WordPress 5.8 – Hide or Remove personal fields from admin Profile page
- Perform multiple actions after wp_insert_user()
- My custom user metadata is only active for only admin but i want it to be active on all users especially customers
- How to get image path from id using SQL
- Getting user data via ajax
- Hook into add_user_role and update based on new and removed roles
- Auto approve new users if their username is included in a predefined list
- meta_query orderby sort multiple keys
- How to update user meta from php file?
- In admin manage users page, how can I stop users with certain privileges from editing users with other privileges?
- Custom registration fields not appearing in user info
- How to restrict Admin from creating new users from Add new user screen in dashboard to only of one domain?
- Get meta key with value for user
- user and usermeta table not found
- Require confirmation of current user’s email before updating database and before send_email_change_email
- UserMeta Changes Meta Value for Post ID
- How do I change the user via SQL?
- Username has been exposed
- Set user role on registration so can upload file to own media library area
- User list order by user meta
- Retrieve New user’s ID
- view and update form only for registered users
- Integrating Facebook Registration (and Login) on a WordPress page
- Problem with update_user_meta() meta_value
- Create Unique and Customized User ID for Website Members in WordPress
- WordPress – Security Question at Login from User’s Meta Data
- Export user data from Squirrly’s Starbox plugin?