- Posts: 1
- Thank you received: 0
When updating a subscription with offline payment, user groups are no longer set
- Aicha Vack
- Topic Author
- Offline
- New Member
-
Less
More
1 day 15 minutes ago #175955
by Aicha Vack
When updating a subscription with offline payment, user groups are no longer set was created by Aicha Vack
Dear MemberShip Pro Team,
We have been using Membership Pro for several years now to sell subscriptions.
The subscription period is one year.
We offer PayPal and offline payment as payment methods.
Offline payment is rarely used.
Users with active subscriptions are assigned to a separate Joomla user group.
When the subscription expires, the user is removed from the user group.
We have now noticed that this mechanism no longer works correctly when
a user renews a subscription,
selects the offline payment method,
and the renewal payment is made before the old subscription expires.
The problem likely started with a Membership Pro update a few months ago.
Because we have so few offline payments, it was only noticed now.
Setting user groups worked correctly in version up to 4.0.0.
It doesn't work in the current version 4.4.1, but probably hasn't worked since version 4.3 or even earlier.
The problem seems to be caused by a changes to the file administrator/components/com_osmembership/model/subscription.php.
The following code has been newly added to the publish() function.
When a subscription is updated, the start date and time are adjusted when the subscription record is created so that the new subscription starts on the same day the old one expires.
If the offline payment is made before the old subscription expires but after the new subscription is ordered,
then the reCalculateSubscriptionDuration function shifts the start date of the new subscription forward by the number of days the payment is made after the order date.
At the same time, the new subscription is activated.
When the old subscription expires, the user is removed from the user group.
However, since the new subscription is already active, the user is not re-added to the correct user group.
This results in people having an active subscription but still not having access to the areas they should be allowed with that subscription.
Similar code for `reCalculateSubscriptionDuration` was also added to the file `administrator/components/com_osmembership/libraries/mpf/payment/common.php`.
I cannot determine whether the solution to the problem lies in revising the code that sets and removes user groups or in revising the `reCalculateSubscriptionDuration` function.
In any case, the assignment of user groups no longer works correctly when using the offline payment method and manually activating a subscription after the payment was recieved (some days later).
Regards and thanks for your nice extension,
Aicha
We have been using Membership Pro for several years now to sell subscriptions.
The subscription period is one year.
We offer PayPal and offline payment as payment methods.
Offline payment is rarely used.
Users with active subscriptions are assigned to a separate Joomla user group.
When the subscription expires, the user is removed from the user group.
We have now noticed that this mechanism no longer works correctly when
a user renews a subscription,
selects the offline payment method,
and the renewal payment is made before the old subscription expires.
The problem likely started with a Membership Pro update a few months ago.
Because we have so few offline payments, it was only noticed now.
Setting user groups worked correctly in version up to 4.0.0.
It doesn't work in the current version 4.4.1, but probably hasn't worked since version 4.3 or even earlier.
The problem seems to be caused by a changes to the file administrator/components/com_osmembership/model/subscription.php.
The following code has been newly added to the publish() function.
Code:
if (str_starts_with($row->payment_method ?? '', 'os_offline')
&& !(int) $rowPlan->expired_date)
{
$this->reCalculateSubscriptionDuration($row);
}
When a subscription is updated, the start date and time are adjusted when the subscription record is created so that the new subscription starts on the same day the old one expires.
If the offline payment is made before the old subscription expires but after the new subscription is ordered,
then the reCalculateSubscriptionDuration function shifts the start date of the new subscription forward by the number of days the payment is made after the order date.
At the same time, the new subscription is activated.
When the old subscription expires, the user is removed from the user group.
However, since the new subscription is already active, the user is not re-added to the correct user group.
This results in people having an active subscription but still not having access to the areas they should be allowed with that subscription.
Similar code for `reCalculateSubscriptionDuration` was also added to the file `administrator/components/com_osmembership/libraries/mpf/payment/common.php`.
I cannot determine whether the solution to the problem lies in revising the code that sets and removes user groups or in revising the `reCalculateSubscriptionDuration` function.
In any case, the assignment of user groups no longer works correctly when using the offline payment method and manually activating a subscription after the payment was recieved (some days later).
Regards and thanks for your nice extension,
Aicha
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
16 hours 36 minutes ago #175958
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic When updating a subscription with offline payment, user groups are no longer set
Thanks Aicha for your feedback. I will check and correct it if the issue is valid, sometime next week
Regards,
Tuan
Regards,
Tuan
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.