• 1 open “cren_plugin.php”

    
    // replace
    wp_mail($email, $title, $body);
    // to 
    	$options = get_option('cren_settings');		
    	if ( $options['cren_custom_mail_onoff'] == true) {			
    		$custom_mail_name = $options['cren_custom_mail_name'];
    		$custom_mail = $options['cren_custom_mail'];
    		
    		$headers = array(
    			'From: '. $custom_mail_name .' <'. $custom_mail .'>',
    				'content-type: text/html'
    			);
    		wp_mail($email, $title, $body, $headers);
    	}else{
    		wp_mail($email, $title, $body);
    	}
    

    2 open “cren_admin.php”

    
    // 2.1 add after 
    function cren_settings_init() {
        $defaults = [
        //  my code  // new 3 options 
            'cren_custom_mail_onoff' => [
                'type'    => 'boolean',
                'default' => false
            ],
    		'cren_custom_mail_name' => [
                'type'    => 'string',
                'default' => ''
            ],
    		'cren_custom_mail' => [
                'type'    => 'string',
                'default' => ''
            ],
    // 2.2	add "add_settings_field
        add_settings_field(
            'cren_custom_mail',
            __('Custom Email ', 'comment-reply-email-notification'),
            'cren_custom_mail_render',
            'cren_admin',
            'cren_admin_section'
        );
    // 2.3 add new function render for new options 
    // add before "function cren_subscription_check_by_default_render(  ) {" 
    
    function cren_custom_mail_render(  ) {
        $options = get_option('cren_settings');
    ?>	
        <input type='checkbox' name='cren_settings[cren_custom_mail_onoff]' <?php checked( $options['cren_custom_mail_onoff'], 1 ); ?> value='1'>
        <input type='text' 	   name='cren_settings[cren_custom_mail_name]' value='<?php echo $options['cren_custom_mail_name']; ?>' style='width: 200px;'>
        <input type='text' 	   name='cren_settings[cren_custom_mail]' value='<?php echo $options['cren_custom_mail']; ?>' style='width: 200px;'><br>
        <span class="description">ON / OFF  | From (Name) | From (@Mail)</span>
    <?php
    }
    
    " 
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Update “custom Usar and eMail”’ is closed to new replies.