• Hello, I have a snippet code that allows me to send an email to the member who sponsors a new member, it helps filter fraudsters. I have a problem, when it is activated, when a member fills out the registration form, once he has clicked on the validation email link, the fields he filled in when registering are empty , he is obliged to redo his profile. I don’t know why, can you help me?

    <?php
    	
    	 /**
      * 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.'.
                                       '',
                    '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['parrain'];
    		
            $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);
    
    ?>
Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter melchi2

    (@melchi2)

    Le code snippset original is:

    '&'      $notifications['um_custom_validate_account'] = array(
                    '&'#039;key'                  => '&'#039;um_custom_validate_account',
                    '&'#039;title'                => __( '&'#039;Send Email for Sponsors Validation','ultimate-member' ),
                    '&'#039;subject'              => '&'#039;{site_name} - Someone you have sponsored on the site needs to attention',
                    '&'#039;body'                 => '&'#039;Hi,<br /><br />'.
                                       '&'#039; You have sponsored '&'quot;{profile_name}&quot; on the site.<br /><br />'.
                                       '&'#039;To view profile, please click the following link: {user_profile_url}',
                    '&'#039;description'          => __('Whether to send the sponsor an email when someone registered has sponsored with.','ultimate-member'),
                    '&'#039;recipient'      => '&'#039;admin',
                    '&'#039;default_active'       => true
            );
    
            return '$notifications';
    }
    add_filter( '&'#039;um_email_notifications', '&'#039;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(&quot;email_parrain);
            $profile_name = um_user(&quot;display_name&quot;);
            $profile_url = um_user_profile_url( $user_id );
    
            UM()->mail()->send( $recipient, '&'#039;um_custom_validate_account', array(
                                    '&'#039;plain_text'   => 1,
                                    '&'#039;tags'                                 => array(
                                            '&'#039;{profile_name}',
                                            '&'#039;{profile_url}',
                                    ),
                                    '&'#039;tags_replace' => array(
                                            $profile_name,
                                            $profile_url,
                                    )
            ) );
    }
    add_action(&quot;um_user_register&quot;,&quot;um_notify_sponsors&quot;,10, 1);
    Thread Starter melchi2

    (@melchi2)

    the original code dont work
    The code snippet you are trying to save produced a fatal error at line 0:

    Directive ‘allow_url_include’ is deprecated

    Thread Starter melchi2

    (@melchi2)

    I also tried with this code but without success, I can’t do it. I called a developer but he can’t do it

    /**
      * 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'      => 'email',
                    '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 = $user_id['email_parrain'];
            $profile_name = $user_id['identifiant'];
            $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_before_save_filter_submitted","um_notify_sponsors",10, 1);

    @melchi2

    I have made some changes to your code snippet:

    add_filter( 'um_email_notifications', 'um_custom_validate_account', 10, 1 );
    add_action( "um_before_save_registration_details", "um_notify_sponsors", 10, 2 );
    
    /**
      * 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'      => 'user',
                'default_active' => true
        );
    
        return $notifications;
    }
    
    /**
    * Send email notification to the sponsor
    */
    function um_notify_sponsors( $user_id, $submitted ){
    
        um_fetch_user( $user_id );
        
        UM()->mail()->send( 
            um_user( 'email_parrain' ), 'um_custom_validate_account', 
                array(
                    'plain_text'   => false,
                    'tags'         => array(
                                        '{profile_name}',
                                        '{profile_url}',
                                    ),
                    'tags_replace' => array(
                                        um_user( 'identifiant' ),
                                        um_user_profile_url( $user_id ),
                                    )
                    ) 
                );
    }
    Thread Starter melchi2

    (@melchi2)

    Thanks Veronica , i try

    • This reply was modified 2 years, 1 month ago by melchi2.
    Thread Starter melchi2

    (@melchi2)

    Now the profile is complete but the sponsor no longer receives emails, it’s madness. I’ll try to improve, I’m crossing my fingers, thanks again Veronica

    Thread Starter melchi2

    (@melchi2)

    With this code the sponsor receives the notification
    but the form is empty, with your code it’s the opposite. I have tried everything without success

    /**
     * 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);
    • This reply was modified 2 years, 1 month ago by melchi2.
    Thread Starter melchi2

    (@melchi2)

    Hello Veronica,

    I tried with your code but I do not receive the godfather does not receive an email
    On the registration form, I modified the email to put custom email, I tried with the keys um_custom_validate_account and um_notify_sponsors, but unfortunately nothing works. Here is the code used

    /**
      * 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 ){
        $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);

    @melchi2

    I tried to make a cleanup of your code snippet but you are still posting your own code.

    You are also posting the same duplicated code snippets in this thread:

    https://www.ads-software.com/support/topic/validation-register-user/

    My suggestion is that you hire a programmer for your UM customization.
    You can look for a WP knowledgable programmer here:

    https://jobs.wordpress.net/

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘empty new member form’ is closed to new replies.