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
- A requested role that is in the (filtered) whitelist is assignable by any actor who passed the vendor-membership checks.
- Privileged roles are stripped after the filter runs —
administrator,shop_manager,editor, andwc_product_vendors_admin_vendorcan never enter the whitelist, even if a site filter adds them. wc_product_vendors_admin_vendorhas a dedicated path outside the whitelist: it can be granted by a user withmanage_woocommerce, or by an existing vendor admin acting on their own vendor’s staff.- The final decision still passes through the
mam_wc_pv_user_can_assign_roleescape-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.
Related articles
- 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 |
