How to manipulate Frontend Manager Sidebar Menus
The following instructions are steps on how to disable/remove menus in the WPCargo Frontend Sidebar.
Codes should put in functions.php of your current theme.
Create Shipment menu
-
How to rename
function custom_wpcfe_create_shipment_callback(){ $menu_label = 'You menu label here'; return $menu_label; } add_filter('wpcfe_create_shipment', 'custom_wpcfe_create_shipment_callback');
-
How to Remove
- Login to you wp-admin page
- Go to admin sidebar menu WPCargo -> Frontend Dashboard
- Check/Tick the checkbox field for the “Disable Create Order“
- Click the “Save Setting” button
Dashboard menu
-
How to rename
function custom_wpcfe_report_menu_label_callback(){ $menu_label = 'You menu label here'; return $menu_label; } add_filter('wpcfe_report_menu_label', 'custom_wpcfe_report_menu_label_callback');
-
How to Remove
function custom_remove_dashboard_menu(){ $current_user = wp_get_current_user(); /* * WPCargo Roles * * wpcargo_client * wpcargo_pending_client * wpcargo_employee * cargo_agent */ /* * Remove the Menu for WPCargo Client only */ if( in_array( 'wpcargo_client', $current_user->roles ) ){ remove_action( 'wpcfe_before_add_shipment', 'wpcfe_shipment_dashboard_menu_callback' ); } } add_action( 'init', 'custom_remove_dashboard_menu' );
Create Order And Store menu
-
How to remove
$current_user = wp_get_current_user(); /* * WPCargo Roles * * wpcargo_client * wpcargo_pending_client * wpcargo_employee * cargo_agent */ /* * Remove the Menu for WPCargo Client only */ function custom_remove_create_order_menu_callback(){ if( in_array( 'wpcargo_client', $current_user->roles ) ){ remove_action( 'wpcfe_after_add_shipment', 'wpcmerch_dashboard_side_menu', 1 ); } } add_action('init', 'custom_remove_create_order_menu_callback');
Add Parcel
-
How to rename
Edit the page from wp-admin and change the page title.
-
How to remove
function custom_remove_add_parcel_menu_callback(){ $current_user = wp_get_current_user(); /* * WPCargo Roles * * wpcargo_client * wpcargo_pending_client * wpcargo_employee * cargo_agent */ /* * Remove the Menu for WPCargo Agent only */ if( in_array( 'cargo_agent', $current_user->roles ) ){ remove_action( 'wpcfe_after_add_shipment', 'wpcsr_menu_items_callback', 10 ); } } add_action('init', 'custom_remove_add_parcel_menu_callback');
Parcel Quoation menu
-
How to rename
Edit the page from wp-admin and change the page title.
-
How to remove
function custom_wpcfe_after_add_shipment_callback(){ $current_user = wp_get_current_user(); /* * WPCargo Roles * * wpcargo_client * wpcargo_pending_client * wpcargo_employee * cargo_agent */ /* * Remove the Menu for WPCargo Client only */ if( in_array( 'wpcargo_client', $current_user->roles ) ){ remove_action( 'wpcfe_after_add_shipment', 'wpcpq_menu_items_callback' ); } } add_action('init', 'custom_wpcfe_after_add_shipment_callback');
Shipments and Order Menu
-
How to rename
function custom_rename_shipment_order_menu_callback( $menu_items ){ $menu_items['shipments-menu']['label'] = 'Your Shipment menu label'; $menu_items["orders-menu"]['label'] = 'Your Order menu label'; return $menu_items; } add_filter( 'wpcfe_after_sidebar_menu_items', 'custom_rename_shipment_order_menu_callback', 99 );
-
How to remove
function custom_remove_shipment_order_menu_callback( $menu_items ){ // Remove Shipment menu unset($menu_items['shipments-menu']); // Remove Order menu unset($menu_items['orders-menu']); return $menu_items; }
Receiving Menu
-
How to rename
function custom_rename_receiving_menu_callback( $menu_items ){ $menu_items['receiving-menu']['label'] = 'Your Shipment menu label'; return $menu_items; } add_filter( 'wpcfe_after_sidebar_menu_items', 'custom_rename_receiving_menu_callback' );
-
How to remove
function custom_remove_receiving_menu_callback(){ $current_user = wp_get_current_user(); /* * WPCargo Roles * * wpcargo_client * wpcargo_pending_client * wpcargo_employee * cargo_agent */ /* * Remove the Menu for WPCargo Client only */ if( in_array( 'wpcargo_client', $current_user->roles ) ){ remove_action( 'wpcfe_after_sidebar_menu_items', 'wpcr_sidebar_menu_items' ); } } add_action('init', 'custom_remove_receiving_menu_callback');
Delivery Menu
-
How to rename
function custom_rename_delivery_menu_callback(){ $menu_label = 'You menu label here'; return $menu_label; } add_filter( 'wpcvr_sidebar_delivery_menu_label', 'custom_rename_delivery_menu_callback' );
-
How to remove
function custom_remove_delivery_menu_callback(){ $current_user = wp_get_current_user(); /* * WPCargo Roles * * wpcargo_client * wpcargo_pending_client * wpcargo_employee * cargo_agent */ /* * Remove the Menu for WPCargo Client only */ if( in_array( 'wpcargo_client', $current_user->roles ) ){ add_action( 'wpcfe_after_add_shipment', 'wpcvr_dashboard_before_sidebar_hook', 10 ); } } add_action('init', 'custom_remove_delivery_menu_callback');
Import/Export
-
How to rename
function custom_rename_import_export_menu_callback( $menu_items ){ $menu_items['wpcie-menu']['label'] = 'Your Shipment menu label'; return $menu_items; } add_filter( 'wpcfe_after_sidebar_menus', 'custom_rename_import_export_menu_callback' );
-
How to remove
// Remove the Import/Export Menu from the Fronend Sidebar menus function remove_wpcargo_import_export_menu(){ $current_user = wp_get_current_user(); /* * WPCargo Roles * * wpcargo_client * wpcargo_pending_client * wpcargo_employee * cargo_agent */ /* * Remove the Menu for WPCargo Client only */ if( in_array( 'wpcargo_client', $current_user->roles ) ){ remove_filter('wpcfe_after_sidebar_menus', 'wpcie_import_export_sidebar_menu', 10 ); } } add_action( 'init', 'remove_wpcargo_import_export_menu' );
Driver Rotue and Driver Report menu
-
How to rename
function custom_rename_driver_menu_callback( $menu_items ){ // Driver Route menu $menu_items['wpcpod-route']['label'] = 'Your Driver Route menu label'; // Driver Report menu $menu_items['wpcpod-menu']['label'] = 'Your Driver Report menu label'; return $menu_items; } add_filter( 'wpcfe_after_sidebar_menus', 'custom_rename_driver_menu_callback' );
-
How to remove
// Remove all POD Drivers Menus Menu from the Fronend Sidebar menus function remove_wpcargo_import_pod_menu(){ $current_user = wp_get_current_user(); /* * WPCargo Roles * * wpcargo_client * wpcargo_pending_client * wpcargo_employee * cargo_agent */ /* * Remove the Menu for WPCargo Client only */ if( in_array( 'wpcargo_client', $current_user->roles ) ){ remove_filter('wpcfe_after_sidebar_menus', 'wpcargo_pod_sidebar_menu', 10 ); } } add_action( 'init', 'remove_wpcargo_import_pod_menu' );
Invoice menu
-
How to remove
// Remove INVOICE Menu from the Fronend Sidebar menus function remove_wpcargo_invoice_menu(){ $current_user = wp_get_current_user(); /* * WPCargo Roles * * wpcargo_client * wpcargo_pending_client * wpcargo_employee * cargo_agent */ /* * Remove the Menu for WPCargo Client only */ if( in_array( 'wpcargo_client', $current_user->roles ) ){ remove_action( 'wpcfe_after_add_shipment', 'wpcinvoice_dashboard_side_menu', 15 ); } } add_action( 'init', 'remove_wpcargo_invoice_menu' );