handle order projects
This commit is contained in:
@@ -3,9 +3,6 @@
|
|||||||
class Wiaas_Admin_Order_Projects {
|
class Wiaas_Admin_Order_Projects {
|
||||||
|
|
||||||
public static function init() {
|
public static function init() {
|
||||||
// Add admin page and subpage since woocommerce orders have custom menu page
|
|
||||||
// so this will not be automatic
|
|
||||||
add_filter('admin_menu', array(__CLASS__, 'add_admin_page'));
|
|
||||||
|
|
||||||
// Add is available fields to create and edit forms
|
// Add is available fields to create and edit forms
|
||||||
add_action( 'shop_order_project_add_form_fields', array( __CLASS__, 'add_is_available_field' ) );
|
add_action( 'shop_order_project_add_form_fields', array( __CLASS__, 'add_is_available_field' ) );
|
||||||
@@ -18,18 +15,20 @@ class Wiaas_Admin_Order_Projects {
|
|||||||
// Save is available field when creating and editing
|
// Save is available field when creating and editing
|
||||||
add_action( 'created_term', array( __CLASS__, 'save_is_available_field' ), 10, 3 );
|
add_action( 'created_term', array( __CLASS__, 'save_is_available_field' ), 10, 3 );
|
||||||
add_action( 'edit_term', array( __CLASS__, 'save_is_available_field' ), 10, 3 );
|
add_action( 'edit_term', array( __CLASS__, 'save_is_available_field' ), 10, 3 );
|
||||||
|
|
||||||
|
add_action( 'load-term.php', array( __CLASS__, 'admin_menu_highlight' ) );
|
||||||
|
add_action( 'load-edit-tags.php', array( __CLASS__, 'admin_menu_highlight' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add admin submenu page for order projects
|
* Highlighting orders menu when shop orders page selected
|
||||||
*/
|
*/
|
||||||
public static function add_admin_page() {
|
public static function admin_menu_highlight() {
|
||||||
add_submenu_page( 'woocommerce',
|
global $plugin_page;
|
||||||
esc_html__( 'Order projects', 'wiaas' ),
|
|
||||||
esc_html__( 'Order projects', 'wiaas' ),
|
if ( isset( $_GET['taxonomy'] ) && ( $_GET['taxonomy'] === 'shop_order_project' ) ) {
|
||||||
'manage_woocommerce',
|
$plugin_page = 'edit.php?post_type=shop_order';
|
||||||
'edit-tags.php?taxonomy=shop_order_project'
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ function wiaas_db_import_aam_role_settings() {
|
|||||||
'menu-woocommerce' => '1',
|
'menu-woocommerce' => '1',
|
||||||
'woocommerce' => '1',
|
'woocommerce' => '1',
|
||||||
'edit.php?post_type=shop_coupon' => '1',
|
'edit.php?post_type=shop_coupon' => '1',
|
||||||
'edit-tags.php?taxonomy=shop_order_project' => '1',
|
|
||||||
'wc-reports' => '1',
|
'wc-reports' => '1',
|
||||||
'wc-settings' => '1',
|
'wc-settings' => '1',
|
||||||
'wc-status' => '1',
|
'wc-status' => '1',
|
||||||
@@ -303,6 +302,7 @@ function wiaas_db_update_update_supplier_capabilities() {
|
|||||||
|
|
||||||
function wiaas_db_update_update_admin_capabilities() {
|
function wiaas_db_update_update_admin_capabilities() {
|
||||||
wp_roles()->add_cap( 'administrator', 'create_products' );
|
wp_roles()->add_cap( 'administrator', 'create_products' );
|
||||||
|
wp_roles()->add_cap( 'administrator', 'manage_wiaas_order_projects' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ class Wiaas_Order_Project {
|
|||||||
'show_admin_column' => true,
|
'show_admin_column' => true,
|
||||||
'query_var' => true,
|
'query_var' => true,
|
||||||
'rewrite' => array( 'slug' => 'shop_order_project' ),
|
'rewrite' => array( 'slug' => 'shop_order_project' ),
|
||||||
|
'capabilities' => array(
|
||||||
|
'manage_terms' => 'manage_wiaas_order_projects',
|
||||||
|
'edit_terms' => 'manage_wiaas_order_projects',
|
||||||
|
'delete_terms' => 'manage_wiaas_order_projects',
|
||||||
|
'assign_terms' => 'manage_wiaas_order_projects',
|
||||||
|
),
|
||||||
'update_count_callback' => array(__CLASS__, 'update_count_callback')
|
'update_count_callback' => array(__CLASS__, 'update_count_callback')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user