title: WooCommerce Product Vendors - add editable roles
body: <p>I’m working with the WooCommerce Product Vendors plugin. I want to allow users with the role of Vendor Admin to add new users with the role of Vendor Manager. I already enabled the capability to list, create, etc. (<code>$role-&gt;add_cap( 'create_users')</code> and such). But, it turns out they can only create new Customers or Subscribers.</p>
  <p>The restriction appears to be coming from inside a class in one of the plugin files - it’s very long so I’m just showing a bit of it here:</p>
  <pre><code>class WC_Product_Vendors_Vendor_Admin {
  
      public static $self;
  
      public static function init() {
          self::$self = new self();
          // filter the user roles
          add_filter( 'editable_roles', array( self::$self, 'filter_user_roles' ) );
      }
  
      public function filter_user_roles( $roles ) {
          $filtered_roles['customer'] = $roles['customer'];
          $filtered_roles['subscriber'] = $roles['subscriber'];
          return $filtered_roles;
      }
  }
  </code></pre>
  <p>If I add in <code>$filtered_roles['wc_product_vendors_manager_vendor'] = $roles['wc_product_vendors_manager_vendor'];</code> then Vendor Manager shows up in the role dropdown for Add Users, and it works.</p>
  <p>But instead of modifying the plugin directly, I want to do it in my custom plugin. At first I thought to add a filter to the &quot;filter_user_roles&quot; function, but I don't know how to target it since it's in a class. Is this possible? I also tried various ways of making my own filter for 'editable_roles', but I haven't been able to get it right. (The only examples I've found with it are of how to remove roles, not add them back when something else is removing them).</p>