1

I have the usual sign up process:

  1. User completes registration form successfully
  2. User receives activation email
  3. User clicks activation link and activates the account
  4. Administrator receives approval request email
  5. Administrator approves (or rejects) user
  6. User gets final approval email

Question: At step 4 in this process I want to send the approval email to only one of several Administrators conditionally depending on a field from the registration form.

I'm looking for advice on the best way to do this, any potential issues? If there are plugins that achieve this, great, otherwise expecting to build my own - any advice/experience on relevant API calls appreciated.

Background:

  • The reason for this need is the organisation has several departments, and we want to get away from keeping a centralised list of who is allowed to sign up from each department held by a single Administrator. Instead we want to send the user signup approval to an Administrator in each department who has access to the necessary information
  • In case it's relevant it's a site that makes heavy use of Buddypress; the field that will determine which Administrator the request goes to is a Buddypress xprofile field.

Thanks

m

3
+100

Not sure this is such a complex issue - WP provides an easy hook to control the email sent to the admin - wp_new_user_notification_email_admin you can read about the parameters here: https://developer.wordpress.org/reference/hooks/wp_new_user_notification_email_admin/

There is a "to" param, which allows you to define the email address to sent to, then it's just a case of creating an array ( manually or pulled from some editable source ) of the emails you want to send to and then using some logic to connect your specific field values to the email, if/else or switch or array_search.. whatever works really..

Not sure what else you need on this?

1
  • 1
    Thanks yep that looks like it might be all I need.
    – mozboz
    Jan 25 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.