protected function verify_save_form($tax_id) { if (!parent::verify_save_form($tax_id)) { return false; } if (!current_user_can('manage_categories')) { return false; } return true; }
/** * Init PRINT and SUBMIT hooks. */ public function init() { // Init fields etc. parent::init(); // Print add_action($this->config['hooks']['print'], array($this, 'print_form')); // Submit add_action('admin_post_nopriv_' . $this->config['hooks']['submit'], array($this, 'submit')); add_action('admin_post_' . $this->config['hooks']['submit'], array($this, 'submit')); if (!empty($this->config['templates']['session'])) { \Cibulka::Base('register_session_var', 'cibulka_form', $this->config['templates']['session']); } /* $i = 1; add_filter('wp_redirect_status', function($status, $location) use ($i) { if ($i > 1) { \Cibulka\dump("redirect loop?"); } update_option($status, $location); $i++; return $status; }, 11, 2); */ }
protected function verify_save_form($user_id) { if (!parent::verify_save_form($user_id)) { return false; } if (!current_user_can('edit_user', $user_id)) { return false; } return true; }
public function init() { parent::init(); add_action('admin_init', array($this, 'register')); }
protected function save_field($field, $field_i, $group_i) { $is_excerpt = method_exists($field, 'is_excerpt') && $field->is_excerpt(); if ($is_excerpt) { $this->extra[] = array('field' => $field, 'is_excerpt' => $is_excerpt); } return parent::save_field($field, $field_i, $group_i); }