function addMenu() { global $userdata; //put a menu for all custom_type $post_types = get_post_types(); $options = get_option('cpto_options'); //get the required user capability $capability = ''; if (isset($options['capability']) && !empty($options['capability'])) { $capability = $options['capability']; } else { if (is_numeric($options['level'])) { $capability = userdata_get_user_level(); } else { $capability = 'install_plugins'; } } foreach ($post_types as $post_type_name) { if ($post_type_name == 'page') { continue; } //ignore bbpress if ($post_type_name == 'reply' || $post_type_name == 'topic') { continue; } if ($post_type_name == 'post') { add_submenu_page('edit.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-' . $post_type_name, array(&$this, 'SortPage')); } else { if (!is_post_type_hierarchical($post_type_name)) { add_submenu_page('edit.php?post_type=' . $post_type_name, __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-' . $post_type_name, array(&$this, 'SortPage')); } } } }
function addMenu() { global $userdata; //put a menu for all custom_type $post_types = get_post_types(); $options = cpt_get_options(); //get the required user capability $capability = ''; if (isset($options['capability']) && !empty($options['capability'])) { $capability = $options['capability']; } else { if (is_numeric($options['level'])) { $capability = userdata_get_user_level(); } else { $capability = 'install_plugins'; } } foreach ($post_types as $post_type_name) { if ($post_type_name == 'page') { continue; } //ignore bbpress if ($post_type_name == 'reply' || $post_type_name == 'topic') { continue; } if (is_post_type_hierarchical($post_type_name)) { continue; } $post_type_data = get_post_type_object($post_type_name); if ($post_type_data->show_ui === FALSE) { continue; } if (isset($options['show_reorder_interfaces'][$post_type_name]) && $options['show_reorder_interfaces'][$post_type_name] != 'show') { continue; } if ($post_type_name == 'post') { add_submenu_page('edit.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-' . $post_type_name, array(&$this, 'SortPage')); } elseif ($post_type_name == 'attachment') { add_submenu_page('upload.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-' . $post_type_name, array(&$this, 'SortPage')); } else { add_submenu_page('edit.php?post_type=' . $post_type_name, __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-' . $post_type_name, array(&$this, 'SortPage')); } } }
function initCPTO() { global $custom_post_type_order, $userdata; $options = cpt_get_options(); if (is_admin()) { if (isset($options['capability']) && !empty($options['capability'])) { if (current_user_can($options['capability'])) { $custom_post_type_order = new CPTO(); } } else { if (is_numeric($options['level'])) { if (userdata_get_user_level(true) >= $options['level']) { $custom_post_type_order = new CPTO(); } } else { $custom_post_type_order = new CPTO(); } } } }
function addMenu() { global $userdata; //put a menu for all custom_type $post_types = get_post_types(); foreach ($post_types as $post_type_name) { if ($post_type_name == 'page') { continue; } if ($post_type_name == 'post') { add_submenu_page('edit.php', 'Re-Order', 'Re-Order', userdata_get_user_level(), 'order-post-types-' . $post_type_name, array(&$this, 'SortPage')); } else { if (!is_post_type_hierarchical($post_type_name)) { add_submenu_page('edit.php?post_type=' . $post_type_name, 'Re-Order', 'Re-Order', userdata_get_user_level(), 'order-post-types-' . $post_type_name, array(&$this, 'SortPage')); } } } }