Approve new user send mail to another role wordpress

A WordPress question!

To approve a new user and send a welcome email to another role in WordPress, you can use the following steps:

Method 1: Using the WordPress Admin Dashboard

  1. Log in to your WordPress dashboard as an administrator.
  2. Go to Users > All Users.
  3. Find the new user you want to approve and click on their username.
  4. Click on the Edit button.
  5. In the Role dropdown menu, select the role you want to assign to the user (e.g., "Editor" or "Author").
  6. Click Update to save the changes.
  7. Go to Settings > General and scroll down to the New User Default Role setting.
  8. Select the role you want to send the welcome email to (e.g., "Subscriber").
  9. Click Save Changes.

Method 2: Using a Plugin

You can also use a plugin like User Role Editor or Role Manager to approve new users and send welcome emails to another role.

  1. Install and activate the plugin.
  2. Go to the plugin's settings page (e.g., User Role Editor > Settings).
  3. Configure the plugin to send a welcome email to the desired role when a new user is approved.
  4. Approve the new user as usual.
  5. The plugin will send a welcome email to the user with the specified role.

Method 3: Using Code

If you're comfortable with coding, you can use the following code snippet to approve a new user and send a welcome email to another role:

// Get the new user ID
$user_id = get_users(array('role' => 'new'))->ID;

// Approve the user
wp_update_user(array('ID' => $user_id, 'role' => 'editor')); // Replace 'editor' with the desired role

// Send a welcome email to the user with the specified role
wp_new_user_notification($user_id, 'editor'); // Replace 'editor' with the desired role

Add this code to your theme's functions.php file or a custom plugin.

Remember to replace 'editor' with the desired role in all three methods.