Created
June 14, 2018 06:13
-
-
Save wtmujeebu/ac9fb11db7415a79afcb43d691206569 to your computer and use it in GitHub Desktop.
Add custom custom role to new members - WebToffee WooCommerce Memberships
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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