Put pending or offline payment users in own group

  • Alan Smith
  • Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 10 months ago #125206 by Alan Smith
Tuan:
I would like to be able to put users with pending status in their own user group OR to do the same with users who checkout with the offline payment option. It seems that running some code in the "Subscription Stored Script " part of the plan would be the logical place. If you point me in. the right direction, I can add the code and try it.

Thanks!
-Alan

Please Log in or Create an account to join the conversation.

More
4 years 10 months ago #125208 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Put pending or offline payment users in own group
Hi Alan

Try this code below (replace 100, 101 with IDs of the user groups you want)
Code:
$user = JFactory::getUser($row->user_id); $currentGroups = $user->get('groups'); $newGroups = [100, 101]; $currentGroups = array_unique(array_merge($currentGroups, $newGroups)); $user->set('groups', $currentGroups); $user->save(true);

Then check to see whether it works

Tuan

Please Log in or Create an account to join the conversation.

  • Alan Smith
  • Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 10 months ago #125210 by Alan Smith
Replied by Alan Smith on topic Put pending or offline payment users in own group
That works perfectly - THANK YOU!

Best regards,
Alan

Please Log in or Create an account to join the conversation.

More
4 years 10 months ago #125232 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Put pending or offline payment users in own group
Great. I'm glad it helps

Tuan

Please Log in or Create an account to join the conversation.