/** * Registers admin menu entry * */ public static function admin_menu_entry() { $access_level = 'activate_plugins'; // Super Admin and Admin $options = get_option(self::ID); if (isset($options['editors_access']) && $options['editors_access']) { $editors_access = true; } else { $editors_access = false; } if ($editors_access) { $access_level = 'moderate_comments'; } // Super Admin, Admin and Editor self::$page_id = add_options_page(self::NAME, self::NAME, $access_level, self::ID, array(__CLASS__, 'settings_page')); // Add a new menu under Manage add_action('manage_' . self::$page_id . '_columns', array(__CLASS__, 'screen_options')); add_action('contextual_help_list', array(__CLASS__, 'help_section')); add_action('admin_init', array(__CLASS__, 'reg_settings')); // registers settings }
} if ($post['new_pos'] < $post['pos']) { q2w3_post_order::change_positions($term_id, $context, 'up', $post['new_pos'], $post['pos']); $wpdb->update(q2w3_post_order::posts_table(), $data, $where); } } } } if ($action == 'update_unsorted') { global $wpdb; $term_id = $_POST['term_id']; $posts = $_POST['posts']; if (!$term_id) { $term_id = 0; } foreach ($posts as $post_id => $post) { if ((int) $post['new_pos'] > 0) { $data = array('post_id' => $post_id, 'term_id' => $term_id, 'post_rank' => $post['new_pos']); if ($post['tax_name']) { $data['taxonomy'] = $post['tax_name']; $context['tax_name'] = $post['tax_name']; } if ($post['post_type']) { $data['post_type'] = $post['post_type']; $context['post_type'] = $post['post_type']; } q2w3_post_order::change_positions($term_id, $context, 'up', $post['new_pos']); $wpdb->insert(q2w3_post_order::posts_table(), $data); } } }