Upgrade option failed to remove old usergroups

  • Elliott
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 11 months ago - 7 years 11 months ago #80811 by Elliott
Hi Tuan,
I found a possible bug in the Membership Pro today.
I can not use the built-in trial functionality because Trial members will have a set of rights they can access while the Permanent Members will have extra rights in addition to the Trial Member's rights.

My OSM Plan setting is:
Trial ---> Usergroup Trial. When expired, user will be moved to "Restricted Members" usergroup.
Permanent ---> Usergroup Permanent

Scenario is: User upgraded their plan using the upgrade plan button prior of the plan expiration. Everything went great except the upgrade option failed to remove the "Restricted Members" from user's group. It added the user to the new Permanent Member group and removed user from Trial members group but didn't remove the Restricted Users group that was left by Trial Membership being inactive.

I have tried to add the following to the Permanent Member plan PHP section:
// Get the connected user
$user = JFactory::getUser();
// remove the user from group ID = x
JUserHelper::removeUserFromGroup($user->get('id'), x );
// reload the user object so the user gets logged out
$session = JFactory::getSession();
$session->set('user', new JUser($user->get('id')));

But that doesn't seem to kick in at all.
Last edit: 7 years 11 months ago by Elliott.

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

More
7 years 11 months ago #80886 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Upgrade option failed to remove old usergroups
Hi Elliott

Could you please send me the screenshot of Joomla groups settings of the two plans? I will then look at it to understand your setup and discuss with you further

Tuan

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

  • Elliott
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 11 months ago #80932 by Elliott
Hi Tuan,

Attached is the screenshot of both plan's setting.
I have fixed the issue by creating a form in RSForm and just did a SQL query to update the plan and the Joomla's group setting. Leaving the OS Membership alone since no matter what I do, the upgrade function in OS Membership will put user into both Permanent and Restricted at the same time when user upgraded their plan. Thus restrict them to see all the content available to Permanent members only.

I have also added a script in the register.php to restrict only 1 registration per IP address. Do you have any plugin for this? Just in case if there is any update later, I can just update instead of re-do my customization.

Best Regards,
Elliott
Attachments:

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