Example #1
0
 public function onRegister($customer_id)
 {
     $this->load->model('setting/setting');
     $this->load->model('module/smsbump');
     $SMSBump = $this->model_setting_setting->getSetting('SMSBump', $this->config->get('store_id'));
     if (strcmp(VERSION, "2.1.0.1") < 0) {
         $this->load->library('smsbump');
     }
     //Send SMS to the admin when new user is registered
     if (isset($SMSBump) && $SMSBump['SMSBump']['Enabled'] == 'yes' && !empty($SMSBump['SMSBump']['APIKey']) && $SMSBump['SMSBump']['AdminRegister']['Enabled'] == 'yes') {
         $customer = $this->db->query("SELECT firstname,lastname,telephone FROM `" . DB_PREFIX . "customer` WHERE customer_id = " . (int) $customer_id);
         if ($customer->row) {
             $nameCustomer = $customer->row['firstname'] . " " . $customer->row['lastname'];
         } else {
             $nameCustomer = '';
         }
         $original = array("{SiteName}", "{CustomerName}");
         $replace = array($this->config->get('config_name'), $nameCustomer);
         $message = str_replace($original, $replace, $SMSBump['SMSBump']['AdminRegisterText']);
         $phone = $SMSBump['SMSBump']['StoreOwnerPhoneNumber'];
         $sendCheck = $this->model_module_smsbump->sendCheck($phone);
         if (!empty($phone) && $sendCheck) {
             SmsBump::sendMessage(array('APIKey' => $SMSBump['SMSBump']['APIKey'], 'to' => $this->model_module_smsbump->formatNumber($phone), 'from' => $SMSBump['SMSBump']['From'], 'message' => $message, 'callback' => array('ModelModuleSmsbump', 'SmsBumpCallback')));
         }
     }
     //Send SMS to the user when the registration is successful
     if (isset($SMSBump) && $SMSBump['SMSBump']['Enabled'] == 'yes' && !empty($SMSBump['SMSBump']['APIKey']) && $SMSBump['SMSBump']['CustomerRegister']['Enabled'] == 'yes') {
         $customer = $this->db->query("SELECT firstname,lastname,telephone FROM `" . DB_PREFIX . "customer` WHERE customer_id = " . (int) $customer_id);
         if ($customer->row) {
             $phone = $customer->row['telephone'];
             $nameCustomer = $customer->row['firstname'] . " " . $customer->row['lastname'];
         } else {
             $phone = '';
             $nameCustomer = '';
         }
         $language = $this->config->get('config_language_id');
         $original = array("{StoreName}", "{CustomerName}");
         $replace = array($this->config->get('config_name'), $nameCustomer);
         $message = str_replace($original, $replace, $SMSBump['SMSBump']['CustomerRegisterText'][$language]);
         $sendCheck = $this->model_module_smsbump->sendCheck($phone);
         if (!empty($phone) && $sendCheck) {
             SmsBump::sendMessage(array('APIKey' => $SMSBump['SMSBump']['APIKey'], 'to' => $this->model_module_smsbump->formatNumber($phone), 'from' => $SMSBump['SMSBump']['From'], 'message' => $message, 'callback' => array('ModelModuleSmsbump', 'SmsBumpCallback')));
         }
     }
 }
Example #2
0
 public function send_5($APIKey, $from, $to, $message, $callback = NULL)
 {
     SmsBump::sendStatic($APIKey, $from, $to, $message, $callback);
 }