How to restrict user role from printing waybill, label and invoice.
Copy and paste the following code in your child theme’s functions.php file.
Restrict specific user role in all printing.
add_filter( 'wpcfe_print_options', 'wpc_customizer_wpcfe_print_callback', 10, 1 ); function wpc_customizer_wpcfe_print_callback( $options ){ $current_user = wp_get_current_user(); if( in_array( 'wpcargo_driver', $current_user->roles) ){ $options = array(); } return $options; }
Restrict specific user role from specific printing.
add_filter( 'wpcfe_print_options', 'wpc_customizer_wpcfe_print_callback', 10, 1 ); function wpc_customizer_wpcfe_print_callback( $options ){ $current_user = wp_get_current_user(); if( in_array( 'wpcargo_driver', $current_user->roles) ){ unset( $options['label] ); unset( $options['waybill] ); unset( $options['invoice] ); } return $options; }
Restrict user roles from specific printing.
add_filter( 'wpcfe_print_options', 'wpc_customizer_wpcfe_print_callback', 10, 1 ); function wpc_customizer_wpcfe_print_callback( $options ){ $current_user = wp_get_current_user(); if( in_array( 'wpcargo_driver, wpcargo_client', $current_user->roles) ){ unset( $options['label] ); unset( $options['waybill] ); unset( $options['invoice] ); } return $options; }