How I Avoid Country code in wordpress sms plugin subscription form?

I have install the wordpress sms plugin and setup it’s setting but now in fornt end subscription form there is country code is compulsory in mobile number text box….

without the country code the message showing “Please Enter Valid Mobile Number….”
How could i solve this ???

Read More

I want to avoid this condition but it’s not working….

        if(isset($_POST['wp_add_subscribe'])) {

        if($name && $mobile && $group) {

            if( (strlen($mobile) >= 11) && (substr($mobile, 0, 2) == get_option('wp_sms_mcc')) && (preg_match("([a-zA-Z])", $mobile) == 0) ) {

                $check_mobile = $wpdb->query($wpdb->prepare("SELECT * FROM `{$table_prefix}sms_subscribes` WHERE `mobile` = '%s'", $mobile));

                if(!$check_mobile) {

                    $check = $wpdb->insert(
                        "{$table_prefix}sms_subscribes", 
                        array(
                            'date'      => $date,
                            'name'      => $name,
                            'mobile'    => $mobile,
                            'status'    => '1',
                            'group_ID'  => $group,
                        )
                    );

                    if($check) {
                        echo "<div class='updated'><p>" . sprintf(__('username <strong>%s</strong> was added successfully.', 'wp-sms'), $name) . "</div></p>";
                    }

                } else {
                    echo "<div class='error'><p>" . __('Phone number is repeated', 'wp-sms') . "</div></p>";
                }
            } else {
                echo "<div class='error'><p>" . __('Please enter a valid mobile number', 'wp-sms') . "</div></p>";
            }
        } else {
            echo "<div class='error'><p>" . __('Please complete all fields', 'wp-sms') . "</div></p>";
        }


    }

Related posts

Leave a Reply

1 comment

  1. Change the 3rd if to

        if((strlen($mobile) >= 9) && (preg_match("([a-zA-Z])", $mobile) == 0)) {
    

    (substr($mobile, 0, 2) == get_option('wp_sms_mcc')) is where this MCC (Mobile Country Code) is verified. I changed from 11 to 9, because the 2-digit country code is no longer required, but you can modify to your needs.