function projekod_add_to_queue() { global $wpdb; if (isset($_POST) && $_POST) { $customers = projekod_get_all_customers(); foreach ($_POST['ids'] as $id) { foreach ($customers as $customer) { if ($customer->id == $id) { $argument = ['ad' => $customer->first_name, 'soyad' => $customer->last_name]; $wpdb->insert($wpdb->prefix . 'sms_queue', ['date_added' => date('Y-m-d H:i:s'), 'status' => '1', 'sms_content' => null, 'template_id' => $_POST['sms_id'], 'phone_number' => $customer->telephone, 'arguments' => json_encode($argument)]); } } } } }
<?php require __DIR__ . '/head.php'; $customers = projekod_get_all_customers(); $sms = projekod_get_sms_template_from_status(1); projekod_add_to_queue(); ?> <div style="margin:20px;"> <form method="post" action=""> <h4>Kullanıcı seçimi yapınız</h4> <table class="wp-list-table widefat fixed striped"> <thead> <tr> <th class="manage-column column-cb check-column"><input type="checkbox"></th> <th>Ad Soyad</th> <th>Mail Adresi</th> <th>GSM</th> <th>İlk Sipariş Tarihi</th> </tr> </thead> <tbody> <?php if (is_array($customers)) { ?> <?php foreach ($customers as $customer) { ?> <tr class="manage-column column-cb check-column"> <td><input type="checkbox" name="ids[]" value="<?php echo $customer->id;