capability 'edit commissions' for managers

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Groups & Staffs capability 'edit commissions' for managers

Viewing 3 reply threads
  • Author
    Posts
    • #92063
      Mcflait
      Participant

      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!

    • #92332
      Sushobhan
      Keymaster

      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

    • #94903
      Mcflait
      Participant

      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!

    • #95096
      Sushobhan
      Keymaster

      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!

Viewing 3 reply threads
  • The topic ‘capability 'edit commissions' for managers’ is closed to new replies.