Issue on affecting a member to a group
-
Hello,
I’m using this plugin and I’m very happy with it.
I just have an issue as I want to affect a member to a specific group inside a hook. Here is my code :add_action(‘cred_commerce_after_payment_completed’,’affectation_membre’,10,1);
function affectation_membre($data)
{
$user = new Groups_User( get_current_user_id() );
$user_id = $user->id;
$group_id == 2;
Group_User_Group::create(array( ‘user_id’ => $user_id, ‘group_id’ => $group_id->group_id ) );
}Could you tell me if there is any issue with this code?
Another point, what if the user is already belonging to the group (is there any new record made in the database or everything is left like it is?).
Many thanks
Pat
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Issue on affecting a member to a group’ is closed to new replies.