Adding additional roles on registration

You check the role not for the created user, only the currently logged in user. Try this way: add_action( ‘user_register’, ‘se333727_additional_roles’ ); function se333727_additional_roles( $user_id ) { $new_user = get_user_by( ‘ID’, $user_id ); if ( in_array( ‘um_dueling-pianist’, (array)$new_user->roles ) ) { $new_user->add_role(‘pianist’); } }

WooCommerce Registration redirect based on page ID

The woocommerce_registration_redirect is a filter hook, but NOT an action hook. I’ve tried the shortcode provided in the mentioned link in your comment above and it works for me in this way: function AS_redirection_after_registration($redirection_url) { if($redirection_url ==”first-page-slug”) // $redirection_url is the slug of the current page where the shortcode is placed return home_url(‘/my-page’); elseif($redirection_url==”second-page-slug”) return … Read more

hooks for automatic approve user registration according to data in custom fields

## Try this if you are using Woocommerce function ws_new_user_approve_registration_message(){ $not_approved_message=”<p class=”registration”>Send in your registration application today!<br /> NOTE: Your account will be held for moderation and you will be unable to login until it is approved.</p>”; if( isset($_REQUEST[‘approved’]) ){ $approved = $_REQUEST[‘approved’]; if ($approved == ‘false’) echo ‘<p class=”registration successful”>Registration successful! You will be … Read more

Send clear password via mail

user_register isn’t the solution for your needs because when this action is trigger, the password is already encrypted. The best solution is to do a custom registration form and insert your new users with this hook: wp_insert_user() When a user is register, you can send a custom email with the password not encrypted.

Using WP for user management

You might want to take a look at the REST API that comes out of the box with WordPress. Here are the docs for Users, you can register users and list/retrieve/update them https://developer.wordpress.org/rest-api/reference/users/ Here’s the information about how to authenticate to use the API (so that you can Reigister Users for instance) https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/

How to add fields in custom registration form, validate it and aave to db? [closed]

To modify the theme’s registration would be possible, but definitely not recommended. It is likely that you would only be able to add your additional fields by directly modifying the theme files, especially with something like user registration. It would be a pain to maintain if you intend to keep your theme up to date. … Read more