Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Groups & Staffs › capability 'edit commissions' for managers
Tagged: Commission, managers
- This topic has 3 replies, 2 voices, and was last updated 5 years ago by Sushobhan.
- AuthorPosts
- November 13, 2019 at 12:02 am #92063McflaitParticipant
Hi! i use the plugin for create managers who handle several shops… and so far so good.
But i dont know what capability i have to deactivate for hiding the commission settings from ‘add product’ page for the managers. I tried with the group capability and the general one for managers but nothing. Im lost here. :/
Thanks!
- November 14, 2019 at 9:09 pm #92332SushobhanKeymaster
Hi,
Please add this code to your site –function disallow_commission_manage_for_managers() { if(wcfm_is_manager()) return false; return true; } add_filter('wcfm_is_allow_commission_manage', 'disallow_commission_manage_for_managers');
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/
Thank You - November 30, 2019 at 3:21 am #94903McflaitParticipant
I tried with this filter, but sadly also disable the ‘store selector’.
so in class-wcfm-vendor-support we had:
if( !wcfm_is_vendor() && apply_filters( 'wcfm_is_allow_commission_manage', true ) && apply_filters( 'wcfm_is_allow_view_commission', true ) ) { // Associate Vendor add_action( 'end_wcfm_products_manage', array( &$this, 'wcfm_associate_vendor' ), 490 ); add_action( 'after_wcfm_products_manage_meta_save', array( &$this, 'wcfm_associate_vendor_save' ), 490, 2 );
i took it out and make and if just with (!wcfm_is_vendor) (yeah, hardcoding with other changes via commits on github). If you had another workarund please let me now. Thanks!
- November 30, 2019 at 11:03 pm #95096SushobhanKeymaster
Changing core files is not the recommended way to do any customization. Better remove the action and filters responsible for commission management after checking the user role –
function remove_comission_for_managers() { global $WCFMmp; if ( wcfm_is_manager() ) { remove_action( 'after_wcfm_products_manage_tabs_content', array( $WCFMmp->wcfmmp_product, 'wcfmmp_product_commission' ), 500, 4 ); remove_action( 'after_wcfm_products_manage_meta_save', array( $WCFMmp->wcfmmp_product, 'wcfmmp_product_commission_save' ), 500, 2 ); // Variation Commission remove_filter( 'wcfm_product_manage_fields_variations', array( $WCFMmp->wcfmmp_product, 'wcfmmp_commission_fields_variations' ), 500, 7 ); remove_filter( 'wcfm_variation_edit_data', array( $WCFMmp->wcfmmp_product, 'wcfmmp_commission_data_variations' ), 500, 3 ); remove_filter( 'wcfm_product_variation_data_factory', array( $WCFMmp->wcfmmp_product, 'wcfmmp_product_variation_commission_save' ), 500, 5 ); } } add_action( 'wcfm_init', 'remove_comission_for_managers', 20 );
I’ll pass this to my development team and ask them to add one additional filter so that in future we can gracefully remove the ‘Commission’ tab without removing the ‘Store’ tab.
Thanks!
- AuthorPosts
- The topic ‘capability 'edit commissions' for managers’ is closed to new replies.