prefix . 'users'; $all_users = $wpdb->get_results("SELECT ID,user_login,user_nicename FROM $all_pushnotification_users"); $error = false; $error_ios = false; $error_android = false; if(isset($_POST['send_now_button'])){ if(isset($_POST['selected_user'])) { $selected_users_id = $_POST['selected_user']; } else {$selected_users_id = array(); } if(isset($_POST['only_ios'])) { $only_ios = $_POST['only_ios']; } else {$only_ios = '';} if(isset($_POST['only_android'])) { $only_android = $_POST['only_android']; } else {$only_android = ''; } $all_pushnotification_token = $wpdb->prefix . 'all_pushnotification_token'; $all_device_tokens = $wpdb->get_results("SELECT device_token FROM $all_pushnotification_token"); if(!wp_verify_nonce($_POST['apn_custom_message'], 'custom_message' )) { print 'Sorry, your nonce did not verify.'; //exit; } else{ if( (!empty($selected_users_id)) && (!empty($all_device_tokens)) ){ $all_userDevices = array(); $message = array("message" => $_POST['message_text'],"title" => $_POST['msg_title']); $push_table_name = $wpdb->prefix . "all_pushnotification_token"; foreach($selected_users_id as $selected_user_id) { $user_data=$wpdb->get_row("SELECT device_token,os_type FROM `$push_table_name` where user_id=".$selected_user_id); if(!empty($user_data->os_type)) { $deviceType = $user_data->os_type; } else { $deviceType = ''; } if(!empty($user_data->device_token)){ $deviceToken = $user_data->device_token; } else { $deviceToken = '';} if ($deviceType == 'android' && $only_android !='') { array_push($all_userDevices, array('token' => $deviceToken, 'is_Android' => true)); } elseif ($deviceType == 'ios' && $only_ios !='') { array_push($all_userDevices, array('token' => $deviceToken, 'is_Android' => false)); } } if(!empty($only_ios)) { $ios_certi_name=get_option('ios_certi_name'); if(empty($ios_certi_name) || strlen($ios_certi_name) <= 0) { $error_ios = true; } } if(!empty($only_android)) { $allpush_google_api_key=get_option('allpush_google_api_key'); if(empty($allpush_google_api_key) || strlen($allpush_google_api_key) <= 0) { $error_android = true; } } if($error == false) { $PushNotifications_obj=new PushNotifications(); $PushNotifications_obj->send_notification($all_userDevices,$message); } } else{ $message = __( 'There was an error sending push notification message, There is no device tokens in table.' ); printf("
%s
", $message); } } if($error_ios == true && $error_android == false) {?>
%s", $message); ?>
%s", $message); ?>
%s", $message); ?>
%s", $message); ?>
:
ID.'>'.$user->user_nicename.''; } ?>
:
:
: