• Resolved bobox

    (@bobox)


    To send an SMS to a mobile in australia I have to add the 61 country code to the mobile number. All my users are in australia and the user’s number does not include the country code. How do I get WP-SMS to automatically add the 61 country code to outbound SMS?

    There is a Mobile country code text box under General where I entered “61” but that does nothing.

    Thanks
    Bob

Viewing 1 replies (of 1 total)
  • Plugin Author Mostafa Soufi

    (@mostafas1990)

    Hey Bob,

    It’s better you add this mobile country code in the gateway class file with Hook.

    For example:

    <?php
    add_filter('wp_sms_to', function($numbers){
    	// Reformat number
    	$to = array();
    	foreach ( $numbers as $number ) {
    		if ( substr( $number, 0, 2 ) === "61" ) {
    			$number = substr( $number, 2 );
    			$number = '0061' . $number;
    		}
    
    		$to[] = $number;
    	}
    
    	return $to;
    })
Viewing 1 replies (of 1 total)

The topic ‘Mobile country code’ is closed to new replies.