Title: validation register user
Last modified: October 21, 2022

---

# validation register user

 *  Resolved [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/validation-register-user/)
 * Hello,
 * On my site new members are sponsored by existing members. During the registration
   form to a sponsor’s email field. I wanted to know:
    If there is a possibility
   of email verification? If the sponsor could receive a copy of the registration
   email? The ideal that it is he who validates it

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Plugin Support [Ultimate Member Support](https://wordpress.org/support/users/ultimatemembersupport/)
 * (@ultimatemembersupport)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16057523)
 * Hi [@melchi2](https://wordpress.org/support/users/melchi2/)
 * Thank you for contacting our support, and I apologize for the delay.
 * >>> If there is a possibility of email verification?
    *** Did you mean you want
   the sponsor to verify the email that he added during the Registration?
 * *** How do you add new members with an existing member?
 * Also, please don’t use the code syntax highlighter for the topic description 
   as it is very difficult to read.
 * Regards,
 *  Thread Starter [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16057560)
 * Hi,
 * I apologize for the difficulty in reading. On my site when registering users 
   must indicate the name and email of the person who sponsored them on the site.
 * I wanted to know if it is possible that the person who sponsored him on the site,
   receives the registration email for the validation account.
 * The goal is to allow the new member to be validated by their sponsor.
 *  Plugin Support [Ultimate Member Support](https://wordpress.org/support/users/ultimatemembersupport/)
 * (@ultimatemembersupport)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16058689)
 * Hi [@melchi2](https://wordpress.org/support/users/melchi2/)
 * I would create a [custom UM notification template](https://www.champ.ninja/2020/05/custom-email-notifications/).
   And then use this action hook `um_user_register` to trigger the custom email.
 * What’s the field key for the sponsor email field?
 * Regards,
 *  Thread Starter [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16063128)
 * Hello,
 * Thank you very much, I think that my request will be of interest to many people.
   My meta key is email_parrain
 *  Plugin Support [Ultimate Member Support](https://wordpress.org/support/users/ultimatemembersupport/)
 * (@ultimatemembersupport)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16067262)
 * Hi [@melchi2](https://wordpress.org/support/users/melchi2/)
 * You can try the following code snippet:
 *     ```
        /**
         * Set custom email notification template and setting
         */
        function um_custom_validate_account( $notifications ){
   
       	$notifications['um_custom_validate_account'] = array(
       		'key'           	=> 'um_custom_validate_account',
       		'title'         	=> __( 'Send Email for Sponsors Validation','ultimate-member' ),
       		'subject'       	=> '{site_name} - Someone you have sponsored on the site needs to attention',
       		'body'          	=> 'Hi,<br /><br />'.
       		                   ' You have sponsored "{profile_name}" on the site.<br /><br />'.
       		                   'To view profile, please click the following link: {user_profile_url}',
       		'description'   	=> __('Whether to send the sponsor an email when someone registered has sponsored with.','ultimate-member'),
       		'recipient'   	 	=> 'admin',
       		'default_active' 	=> true
       	);
   
       	return $notifications;
       }
       add_filter( 'um_email_notifications', 'um_custom_validate_account', 10, 1 );
   
       /**
        * Send email notification to the sponsor
        */
       function um_notify_sponsors( $user_id ){
   
           um_fetch_user( $user_id ); 
           $sponsor_recipient = um_user("email_parrain);
       	$profile_name = um_user("display_name");
       	$profile_url = um_user_profile_url( $user_id );
   
       	UM()->mail()->send( $sponsor_recipient, 'um_custom_validate_account', array(
       				'plain_text'	 => 1,
       				'tags'				 => array(
       					'{profile_name}',
       					'{profile_url}',
       				),
       				'tags_replace' => array(
       					$profile_name,
       					$profile_url,
       				)
       	) );
       }
       add_action("um_user_register","um_notify_sponsors",10, 1);
       ```
   
 * Make sure that you’ve turned on this custom email notification in WP Admin > 
   Ultimate Member > Settings > Emails.
 * Just add this sample email body:
 *     ```
       Hi,<br /><br />'.
       You have sponsored "{profile_name}" on the site.<br /><br />'.
       To view the profile, please click the following link: {user_profile_url}
       ```
   
 * Email subject:
    `{site_name} - Someone you have sponsored has joined our site'`
 * Regards,
    -  This reply was modified 3 years, 7 months ago by [Ultimate Member Support](https://wordpress.org/support/users/ultimatemembersupport/).
 *  Thread Starter [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16073112)
 * Hello I tried to put this code but I get stuck with this error message line 0:
 * Directive ‘allow_url_include’ is deprecated
 * I don’t know why, I’m using Cpanel with PHP 7.4
    If you have any advice, I’ll
   take it, thank you in advance for your help
 *  Thread Starter [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16109547)
 * Bonjour,
 * Malgré de multiples essaie le parrain ne reçoit pas les mails
 *     ```
       /**
         * Set custom email notification template and setting
         */
        function um_custom_validate_account( $notifications ){
   
               $notifications['um_custom_validate_account'] = array(
                       'key'                  => 'um_custom_validate_account',
                       'title'                => __( 'Send Email for Sponsors Validation','ultimate-member' ),
                       'subject'              => '{site_name} - Someone you have sponsored on the site needs to attention',
                       'body'                 => 'Hi,<br /><br />'.
                                          ' You have sponsored "{profile_name}" on the site.<br /><br />'.
                                          'To view profile, please click the following link: {user_profile_url}',
                       'description'          => __('Whether to send the sponsor an email when someone registered has sponsored with.','ultimate-member'),
                       'recipient'      => 'admin',
                       'default_active'       => true
               );
   
               return $notifications;
       }
       add_filter( 'um_email_notifications', 'um_custom_validate_account', 10, 1 );
   
       /**
        * Send email notification to the sponsor
        */
       function um_notify_sponsors( $user_id ){
   
           um_fetch_user( $user_id );
           $sponsor_recipient = um_user("email_parrain");
               $profile_name = um_user("display_name");
               $profile_url = um_user_profile_url( $user_id );
   
               UM()->mail()->send( $sponsor_recipient, 'um_custom_validate_account', array(
                                       'plain_text' => 1,
                                       'tags' => array(
                                               '{profile_name}',
                                               '{profile_url}',
                                       ),
                                       'tags_replace' => array(
                                               $profile_name,
                                               $profile_url,
                                       )
               ) );
       }
   
       add_action("um_user_register","um_notify_sponsors",10, 1);
       ```
   
 *  Thread Starter [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16121536)
 * Hello, I tried everything but the sponsor does not receive an email, I even looked
   at and integrated the example of Champ, https:[https://www.champ.ninja/2020/05/custom-email-notifications/](https://www.champ.ninja/2020/05/custom-email-notifications/)
 *     ```
       /**
         * Set custom email notification template and setting
         */
        function um_custom_validate_account( $notifications ){
   
       	$notifications['um_custom_validate_account'] = array(
       		'key'           	=> 'um_custom_validate_account',
       		'title'         	=> __( 'Send Email for Sponsors Validation','ultimate-member' ),
       		'subject'       	=> '{site_name} - Someone you have sponsored on the site needs to attention',
       		'body'          	=> 'Hi,<br /><br />'.
       		                   ' You have sponsored "{profile_name}" on the site.<br /><br />'.
       		                   'To view profile, please click the following link: {user_profile_url}',
       		'description'   	=> __('Whether to send the sponsor an email when someone registered has sponsored with.','ultimate-member'),
       		'recipient'   	 	=> 'admin',
       		'default_active' 	=> true
       	);
   
       	return $notifications;
       }
       add_filter( 'um_email_notifications', 'um_custom_validate_account', 10, 2 );
   
       /**
        * Send email notification to the sponsor
        */
       function um_notify_sponsors( $user_id ){
           $user_id = $user->ID;
           um_fetch_user( $user_id ); 
           $sponsor_recipient  = um_user( 'email_parrain' );
       	$profile_name  = um_user( 'user_login ');
       	$profile_url  = um_user_profile_url( $user_id );
   
       	UM()->mail()->send( $sponsor_recipient,'um_custom_validate_account', array(
       				'plain_text'	 => 0,
       				'tags'				 => array(
       					'{profile_name}',
       					'{profile_url}',
       				),
       				'tags_replace' => array(
       					$profile_name,
       					$profile_url,
       				)
       	) );
       }
       add_action("um_user_register","um_notify_sponsors",10, 2);
       ```
   
 * With this script I have the notification but it empties the profile once the 
   validation is done
 *     ```
       /**
         * Set custom email notification template and setting
         */
   
        function um_custom_validate_account( $notifications ){
   
               $notifications['um_custom_validate_account'] = array(
                       'key'                  => 'um_custom_validate_account',
                       'title'                => __( 'Send Email for Sponsors Validation','ultimate-member' ),
                       'subject'              => '{site_name} - Someone you have sponsored on the site needs to attention',
                       'body'                 => 'Hi,<br /><br />'.
                                          ' You have sponsored "{profile_name}" on the site.<br /><br />'.
                                          '',
                       'description'          => __('Whether to send the sponsor an email when someone registered has sponsored with.','ultimate-member'),
                       'recipient'      => 'admin',
                       'default_active'       => true
               );
   
               return $notifications;
       }
       add_filter( 'um_email_notifications', 'um_custom_validate_account', 10, 1 );
   
       /**
        * Send email notification to the sponsor
        */
       function um_notify_sponsors($data)
       {
   
       		$sponsor_recipient = $data['email_parrain'];
   
               $profile_name =$data['user_login'];
   
               $profile_url = "";
   
   
               UM()->mail()->send( $sponsor_recipient, 'um_custom_validate_account', array(
                                       'plain_text' =>0 ,
                                       'tags' => array(
                                               '{profile_name}',
                                               '{profile_url}',
                                       ),
                                       'tags_replace' => array(
                                               $profile_name,
                                               $profile_url,
                                       )
               ) );
   
   
   
   
       }
   
       add_action("um_before_save_filter_submitted","um_notify_sponsors",10, 1);
   
       ?>
       ```
   
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16121793)
 * [@melchi2](https://wordpress.org/support/users/melchi2/)
 * You are posting questions about the same code snippet in this thread:
 * [https://wordpress.org/support/topic/empty-new-member-form/](https://wordpress.org/support/topic/empty-new-member-form/)
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [3 years, 7 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16121881)
 * [@melchi2](https://wordpress.org/support/users/melchi2/) Please do not create
   multiple topics for the same thing. I closed the newer topic.
 *  Thread Starter [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16122083)
 * Hello, I wanted to apologize for the multiple post, I will see to hire a competent
   developer because the last one unfortunately deceived me. Thank you all for your
   time.
 *  Thread Starter [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16302715)
 * <font _mstmutation=”1″ _msthash=”991094″>
 * /**
    - Set custom email notification template and setting
      */function um_custom_validate_account(
      $notifications ){ $notifications[‘um_custom_validate_account’] = array(‘key’
      => ‘um_custom_validate_account’,‘title’ => **( ‘Send Email for Sponsors Validation’,’
      ultimate-member’ ), ‘subject’ => ‘{site_name} – Someone you have sponsored
      on the site needs to attention’, ‘body’ => ‘Hi,‘. ‘ You have sponsored “{profile_name}”
      on the site.‘. ‘To view profile, please click the following link: {user_profile_url}’,‘
      description’ => (‘Whether to send the sponsor an email when someone registered
      has sponsored with.’,’ultimate-member’),‘recipient’ => ‘admin’,‘default_active’
      => true); return $notifications;}add_filter( ‘um_email_notifications’, ‘um_custom_validate_account’,
      10, 1 );
 * /**
    - I post it here, you never know it can be useful, with this code the profile
      and the sending of notification is done, the only problem is the link to the
      profile which does not work<font _mstmutation=”1″ _msthash=”1325532″>
    - Envoyer une notification par e-mail au sponsor
      */function um_notify_sponsors(
      $user_id ){ um_fetch_user( $user_id ); $sponsor_recipient = um_user(« email_parrain»);
      $profile_name = um_user(« display_name »); $profile_url = um_user_profile_url(
      $user_id ); UM()->mail()->send( $sponsor_destinataire, ‘um_custom_validate_account’,
      array(‘plain_text’ => 1,’tags’ => array(‘{profile_name}’,'{profile_url}’,),’
      tags_replace’ => array($profile_name,$profile_url,)) ); }add_action(« um_after_save_registration_details»,”
      um_notify_sponsors »,10, 2);
 *  Thread Starter [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16326962)
 * <font _mstmutation=”1″ _msthash=”881764″></font>
 * Here is the final script that works
 * /**
 *   * Set custom email notification template and setting
 *   */
 *  function um_custom_validate_account( $notifications ){
 * $notifications[‘um_custom_validate_account’] = array(
 * ‘key’           => ‘um_custom_validate_account’,
 * ‘title’         => __( ‘Send Email for Sponsors Validation’,’ultimate-member’),
 * ‘subject’       => ‘{site_name} – Someone you have sponsored on the site needs
   to attention’,
 * ‘body’          => ‘Hi,<br /><br />’.
 *                   ‘You have sponsored “{profile_name}” on the site.<br /><br /
   >’.
 *                   ‘To view profile, please click the following link: {profile_link}’,
 * ‘description’   => __(‘Whether to send the sponsor an email when someone registered
   has sponsored with.’,’ultimate-member’),
 * ‘recipient’   => ‘admin’,
 * ‘default_active’ => true
 * );
 * return $notifications;
 * }
 * add_filter( ‘um_email_notifications’, ‘um_custom_validate_account’, 10, 1 );
 * /**
 *  * Send email notification to the sponsor
 *  */
 * function um_notify_sponsors( $user_id ){
 *     um_fetch_user( $user_id ); 
 *     $sponsor_recipient = um_user(“email_parrain”);
 * $profile_name = um_user(“display_name”);
 * $profile_link = ‘<a href=”‘ . um_user_profile_url( $user_id ) . ‘”>’ . um_user_profile_url(
   $user_id ) . ‘</a>’;
 * UM()->mail()->send( $sponsor_recipient, ‘um_custom_validate_account’, array(
 * ‘plain_text’ => 1,
 * ‘tags’ => array(
 * ‘{profile_name}’,
 * ‘{profile_link}’,
 * ),
 * ‘tags_replace’ => array(
 * $profile_name,
 * $profile_link,
 * )
 * ) );
 * }
 * add_action(“um_after_save_registration_details”,”um_notify_sponsors”,10, 2);
 *  Thread Starter [melchi2](https://wordpress.org/support/users/melchi2/)
 * (@melchi2)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16396760)
 * Hello, I am sending you the script that allows the sponsor to receive an email
   when registering the godchild, to visit his file and to check the sponsor’s email
   during registration.<font _mstmutation=”1″ _msthash=”1047670″></font>
 *     ```wp-block-code
       add_action( 'um_custom_field_validation_email_parrain', 'um_custom_validate_email_parrain', 999, 3 );
       function um_custom_validate_email_parrain( $key, $array, $args ) {
           if ( $key == 'email_parrain' && isset( $args['email_parrain'] ) ) {
               if ( isset( UM()->form()->errors['email_parrain'] ) ) {
                   unset( UM()->form()->errors['email_parrain'] );
               }
               if ( ! is_email( $args['email_parrain'] ) ) {
                   UM()->form()->add_error( 'email_parrain', __( 'L’adresse e-mail du parrain que vous avez saisie n’est pas valide', 'membre-ultime' ) );
               } elseif ( ! email_exists( $args['email_parrain'] ) ) {
                   UM()->form()->add_error( 'email_parrain', __( 'L’adresse e-mail du parrain que vous avez saisie n\'existe pas dans les comptes des membres.', 'membre-ultime' ) );
               }
           }
       }
   
   
       /**
        * Set custom email notification template and setting
        */
       function um_custom_validate_account( $notifications ){
   
           $notifications['um_custom_validate_account'] = array(
               'key'           	=> 'um_custom_validate_account',
               'title'         	=> __( 'Send Email for Sponsors Validation','ultimate-member' ),
               'subject'       	=> '{site_name} - Someone you have sponsored on the site needs to attention',
               'body'          	=> 'Hi,<br /><br />'.
                                  'You have sponsored "{profile_name}" on the site.<br /><br />'.
                                  'To view profile, please click the following link: {profile_link}',
               'description'   	=> __('Whether to send the sponsor an email when someone registered has sponsored with.','ultimate-member'),
               'recipient'   	 	=> 'admin',
               'default_active' 	=> true
           );
   
           return $notifications;
       }
       add_filter( 'um_email_notifications', 'um_custom_validate_account', 10, 1 );
   
       /**
        * Send email notification to the sponsor
        */
       function um_notify_sponsors( $user_id ){
           um_fetch_user( $user_id ); 
           $sponsor_email = um_user("email_parrain");
           if (!filter_var($sponsor_email, FILTER_VALIDATE_EMAIL)) {
               // Afficher un message d'erreur
               UM()->notifications()->add( 'SponsorInvalidEmail', 'L\'adresse e-mail du parrain n\'est pas valide.' );
               return;
           }
   
           if ( ! email_exists( $sponsor_email ) ) {
               // Afficher un message d'erreur
               UM()->notifications()->add( 'SponsorNotExist', 'L\'adresse e-mail du parrain n\'existe pas dans les comptes des membres.' );
               return;
           }
           // code pour envoyer la notification
           $sponsor_recipient = $sponsor_email;
           $profile_name = um_user("display_name");
           $profile_link = '<a href="' . um_user_profile_url( $user_id ) . '">' . um_user_profile_url( $user_id ) . '</a>';
   
           UM()->mail()->send( $sponsor_recipient, 'um_custom_validate_account', array(
                       'plain_text'	 => 1,
                       'tags'				 => array(
                           '{profile_name}',
                           '{profile_link}',
                       ),
                       'tags_replace' => array(
                           $profile_name,
                           $profile_link,
                       )
           ) );
   
       }
       add_action("um_after_save_registration_details","um_notify_sponsors",10, 2);
       ```
   

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘validation register user’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 14 replies
 * 4 participants
 * Last reply from: [melchi2](https://wordpress.org/support/users/melchi2/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/validation-register-user/#post-16396760)
 * Status: resolved