$form['es_note_id'] = isset($_POST['es_note_id']) ? $_POST['es_note_id'] : ''; // No errors found, we can add this Group to the table if ($es_error_found == FALSE) { $action = false; $listcategory = ""; $total = count($es_note_cat); if ($total > 0) { for ($i = 0; $i < $total; $i++) { $listcategory = $listcategory . " ##" . $es_note_cat[$i] . "## "; if ($i != $total - 1) { $listcategory = $listcategory . "--"; } } } $form['es_note_cat'] = $listcategory; $action = es_cls_notification::es_notification_ins($form, $action = "update"); if ($action == "sus") { $es_success = __('Notification was successfully updated.', 'email-subscribers'); } } } if ($es_error_found == TRUE && isset($es_errors[0]) == TRUE) { ?> <div class="error fade"><p><strong><?php echo $es_errors[0]; ?> </strong></p></div><?php } if ($es_error_found == FALSE && strlen($es_success) > 0) { ?> <div class="updated fade">
} // No errors found, we can add this Group to the table if ($es_error_found == FALSE) { $action = false; $listcategory = ""; $total = count($es_note_cat); if ($total > 0) { for ($i = 0; $i < $total; $i++) { $listcategory = $listcategory . " ##" . $es_note_cat[$i] . "## "; if ($i != $total - 1) { $listcategory = $listcategory . "--"; } } } $form['es_note_cat'] = $listcategory; $action = es_cls_notification::es_notification_ins($form, $action = "insert"); if ($action) { $es_success = __('Notification was successfully created.', 'email-subscribers'); } // Reset the form fields $form = array('es_note_id' => '', 'es_note_cat' => '', 'es_note_group' => '', 'es_note_templ' => '', 'es_note_status' => ''); } } if ($es_error_found == TRUE && isset($es_errors[0]) == TRUE) { ?> <div class="error fade"><p><strong><?php echo $es_errors[0]; ?> </strong></p></div><?php } if ($es_error_found == FALSE && strlen($es_success) > 0) {
public static function es_notifications_default() { $result = es_cls_notification::es_notification_count(0); if ($result == 0) { $form["es_note_group"] = "Public"; $form["es_note_status"] = "Enable"; $form["es_note_templ"] = "1"; $listcategory = ""; $args = array('hide_empty' => 0, 'orderby' => 'name', 'order' => 'ASC'); $categories = get_categories($args); $total = count($categories); $i = 1; foreach ($categories as $category) { $listcategory = $listcategory . " ##" . $category->cat_name . "## "; if ($i < $total) { $listcategory = $listcategory . "--"; } $i = $i + 1; } $form["es_note_cat"] = $listcategory; es_cls_notification::es_notification_ins($form, "insert"); } return true; }