/** Ajax module for change list */
 public static function ajax_change_list()
 {
     $list_id = $_POST['list_id'];
     $home_settings = get_option(SIB_Manager::home_option_name);
     $home_settings['list_id'] = $list_id;
     update_option(SIB_Manager::home_option_name, $home_settings);
     // get total contacts
     $mailin = new Mailin(SIB_Manager::sendinblue_api_url, SIB_Manager::$access_key);
     $data = array('id' => $list_id);
     $list_info = $mailin->get_list($data);
     if (!is_array($list_info)) {
         $total_subscribers = 0;
     } else {
         $total_subscribers = intval($list_info['data']['total_subscribers']);
     }
     echo $total_subscribers;
     die;
 }
Exemple #2
0
 /** Ajax module for change list */
 function ajax_change_list()
 {
     $list_id = $_POST['list_id'];
     $home_settings = get_option(SIB_Manager::home_option_name);
     $home_settings['list_id'] = $list_id;
     update_option(SIB_Manager::home_option_name, $home_settings);
     // get total contacts
     $mailin = new Mailin('https://api.sendinblue.com/v1.0', SIB_Manager::$access_key, SIB_Manager::$secret_key);
     $list_info = $mailin->get_list($list_id);
     if (!is_array($list_info)) {
         $total_subscribers = 0;
     } else {
         $total_subscribers = intval($list_info['data']['total_subscribers']);
     }
     echo $total_subscribers;
     die;
 }