Skip to content

Instantly share code, notes, and snippets.

@wtmujeebu
Created June 14, 2018 06:13
Show Gist options
  • Save wtmujeebu/ac9fb11db7415a79afcb43d691206569 to your computer and use it in GitHub Desktop.
Save wtmujeebu/ac9fb11db7415a79afcb43d691206569 to your computer and use it in GitHub Desktop.
Add custom custom role to new members - WebToffee WooCommerce Memberships
add_filter('hf_memberships_new_membership_data', 'webtoffee_assign_role_after_membership');
function webtoffee_assign_role_after_membership($new_membership_data, $user_id_product_id_order_id) {
$theUser = new WP_User($user_id_product_id_order_id['user_id']);
$role = 'mycustomrole'; // string $role = Role name
$theUser->add_role($role);
return $new_membership_data;
}
// https://wordpress.org/plugins/xa-woocommerce-memberships/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment