Hook: mam_pv_assignable_roles

Signature

$roles = apply_filters( 'mam_pv_assignable_roles', array(
    'wc_product_vendors_manager_vendor',
    'wc_product_vendors_pending_vendor',
    'driver',
    'customer',
) );
Parameter Type Description
$roles string[] Role slugs that vendor-facing app flows are allowed to assign

Returns the whitelist used by mam_wc_pv_user_can_assign_role.

When it fires

Inside the role-assignment authorization check (mam_wc_pv_authorization::user_can_assign_role()), which runs on every Staff Manager submission — both when editing an existing staff member’s role and when inviting a new one.

The rules around the whitelist

  1. A requested role that is in the (filtered) whitelist is assignable by any actor who passed the vendor-membership checks.
  2. Privileged roles are stripped after the filter runsadministrator, shop_manager, editor, and wc_product_vendors_admin_vendor can never enter the whitelist, even if a site filter adds them.
  3. wc_product_vendors_admin_vendor has a dedicated path outside the whitelist: it can be granted by a user with manage_woocommerce, or by an existing vendor admin acting on their own vendor’s staff.
  4. The final decision still passes through the mam_wc_pv_user_can_assign_role escape-hatch filter.

Example — allow a custom staff role

add_filter( 'mam_pv_assignable_roles', function ( array $roles ) {
    $roles[] = 'kitchen_staff'; // your custom role
    return $roles;
} );

Example — tighten the default list

add_filter( 'mam_pv_assignable_roles', function ( array $roles ) {
    // Vendors may only manage managers; no driver/customer churn from the app.
    return array( 'wc_product_vendors_manager_vendor' );
} );

Notes

  • This whitelist governs app-driven role assignment only; wp-admin user management is untouched.
  • Adding a privileged role here is silently ignored (rule 2) — that is intentional, not a bug.

  • Recipe: Staff manager configuration
  • Hooks: `mam_wc_pv_usercan` authorization filters*

Metadata

Field Value
Article type Hook Reference
Plugin slug mam-woocommerce-product-vendors
Applies to plugin version 26.19.1+
Category Extending MAM Suite
Hook type filter
Audience PHP developer / integrator
Last verified 2026-06-10
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!