Support » Plugin: Email Subscribers & Newsletters » issue in error message

  • Resolved Dharmesh B Panchal

    (@dharmesh351991)


    Hello I have update new version of plugin today.
    When leave blank email id fields and submit it then it will not occur any type of error. I reviewed your plugin JS and PHP code that you have not condition for empty email fields.Please solve this issue.
    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • @dharmesh351991

    Thank you for pointing this out to us. I have informed our lead developer about it and we would surely work on this soon. Do let me know if you need any help further.

    Open plugins/email-subscribers/job/es-subscribe.php file, and comment a below mentioned code at line 52.
    $es_response = array();

    Developer mistakenly emptied the default status assigned array variable which you will find at line 19.

    So basically plugin sending an empty response to blank/empty email input.

    • This reply was modified 1 year, 3 months ago by  jitesh.tandel.

    Here is the full function that I am using right now.Please check and correct it on your website.

    public function es_add_subscriber() {
    
    		// check_admin_referer( 'es-subscribe', 'es-subscribe' );
    
    		$es_response = array( 'error' => 'unexpected-error' );
    
    		if ( ( isset( $_REQUEST['es'] ) ) && ( $_REQUEST['es'] == 'subscribe' ) && ( isset( $_REQUEST['action'] ) ) && ( $_REQUEST['action'] == 'es_add_subscriber' ) && !empty( $_REQUEST['esfpx_es-subscribe'] ) ) {
    			$es_subscriber_name = '';
    			$es_subscriber_email = '';
    			$es_subscriber_group = '';
    
    			foreach ($_REQUEST as $key => $value) {
    				$new_key = str_replace('_pg', '', $key);
    				$_REQUEST[$new_key] = $value;
    			}
    
    			$es_subscriber_name  = isset( $_REQUEST['esfpx_es_txt_name'] ) ? $_REQUEST['esfpx_es_txt_name'] : '';
    			$es_subscriber_email = isset( $_REQUEST['esfpx_es_txt_email'] ) ? $_REQUEST['esfpx_es_txt_email'] : '';
    			$es_subscriber_group = isset( $_REQUEST['esfpx_es_txt_group'] ) ? $_REQUEST['esfpx_es_txt_group'] : '';
    			$es_nonce 			 = $_REQUEST['esfpx_es-subscribe'];
    
    			$es_subscriber_name  = trim( $es_subscriber_name );
    			$es_subscriber_email = trim( $es_subscriber_email );
    			$es_subscriber_group = trim( $es_subscriber_group );
    
    			$subscriber_form = array(
    									'es_email_name' => '',
    									'es_email_mail' => '',
    									'es_email_group' => '',
    									'es_email_status' => '',
    									'es_nonce' => ''
    								);
    
    			if( $es_subscriber_group == '' ) {
    				$es_subscriber_group = 'Public';
    			}
    
    			if ( $es_subscriber_email != '' ) {
                    $es_response = array();
    				if ( !filter_var( $es_subscriber_email, FILTER_VALIDATE_EMAIL ) ) {
    					$es_response['error'] = 'invalid-email';
    				} else {
    					$home_url = home_url();
    					$same_domain = strpos( $_SERVER['HTTP_REFERER'] , $home_url );
    					if ( $same_domain !== false && $same_domain < 5 ) {
    						$action = '';
    						global $wpdb;
    
    						$subscriber_form['es_email_name'] = $es_subscriber_name;
    						$subscriber_form['es_email_mail'] = $es_subscriber_email;
    						$subscriber_form['es_email_group'] = $es_subscriber_group;
    						$subscriber_form['es_nonce'] = $es_nonce;
    
    						$es_optintype = get_option( 'ig_es_optintype' );
    
    						if( $es_optintype == "Double Opt In" ) {
    							$subscriber_form['es_email_status'] = "Unconfirmed";
    						} else {
    							$subscriber_form['es_email_status'] = "Single Opt In";
    						}
    
    						$action = es_cls_dbquery::es_view_subscriber_widget($subscriber_form);
    						if( $action == "sus" ) {
    							$subscribers = array();
    							$subscribers = es_cls_dbquery::es_view_subscriber_one($es_subscriber_email,$es_subscriber_group);
    							if( $es_optintype == "Double Opt In" ) {
    								es_cls_sendmail::es_sendmail("optin", $template = 0, $subscribers, "optin", 0);
                                    $es_response['success'] = 'subscribed-pending-doubleoptin';
    							} else {
    								$es_c_usermailoption = get_option( 'ig_es_welcomeemail' );
    								if ( $es_c_usermailoption == "YES" ) {
    									es_cls_sendmail::es_sendmail("welcome", $template = 0, $subscribers, "welcome", 0);
    								}
    								$es_response['success'] = 'subscribed-successfully';
    							} 
    						} elseif( $action == "ext" ) {
    							$es_response['success'] = 'already-exist';
    						} elseif( $action == "invalid" ) {
    							$es_response['error'] = 'invalid-email';
                            }else{
                                $es_response['error'] = 'unexpected-error';
                            }
    					} else {
    						$es_response['error'] = 'unexpected-error';
    					}
    				}
    			}
    		}
    
    		echo json_encode($es_response);
    		die();
    	}

    @jiteshtandel

    Thank you for helping us here.
    We are already working on it and would fix it soon.

    Do let me know if you need any help further.

    Plugin Author Icegram

    (@icegram)

    @dharmesh351991 ,

    Please update to the latest version as it handles cases that you pointed out.

    @jiteshtandel ,

    Thank you for pointing it out. This is also fixed in latest release.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘issue in error message’ is closed to new replies.