Expiring User Upgrades

Expiring User Upgrades [Paid] 1.3.8

No permission to buy ($20.00)
  • Thread starter Thread starter Syndol
  • Start date Start date
@Xon, when manually upgrading user on version 1.2.3 this is error (user is not upgraded)
Code:
Server Error Log
Error Info
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry '92' for key 'PRIMARY' - library/Zend/Db/Statement/Mysqli.php:214
Generated By: Sunka, 9 minutes ago
Stack Trace
#0 /home/nginx/domains/pijanitvor.com/public/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/nginx/domains/pijanitvor.com/public/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/nginx/domains/pijanitvor.com/public/library/Zend/Db/Adapter/Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xf...', Array)
#3 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Model/UserUpgrade.php(532): Zend_Db_Adapter_Abstract->insert('xf_user_upgrade...', Array)
#4 /home/nginx/domains/pijanitvor.com/public/library/SV/ExpiringUserUpgrades/XenForo/Model/UserUpgrade.php(235): XenForo_Model_UserUpgrade->upgradeUser(37095, Array, true, 1511046000)
#5 /home/nginx/domains/pijanitvor.com/public/library/XenForo/ControllerAdmin/UserUpgrade.php(311): SV_ExpiringUserUpgrades_XenForo_Model_UserUpgrade->upgradeUser(37095, Array, true, 1511046000)
#6 /home/nginx/domains/pijanitvor.com/public/library/SV/ExpiringUserUpgrades/XenForo/ControllerAdmin/UserUpgrade.php(36): XenForo_ControllerAdmin_UserUpgrade->actionManual()
#7 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(351): SV_ExpiringUserUpgrades_XenForo_ControllerAdmin_UserUpgrade->actionManual()
#8 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/nginx/domains/pijanitvor.com/public/admin.php(13): XenForo_FrontController->run()
#10 {main}
Request State
array(3) {
  ["url"] => string(82) "https://www.pijanitvor.com/admin.php?user-upgrades/premium-grupa-1-mjesec.3/manual"
  ["_GET"] => array(1) {
    ["user-upgrades/premium-grupa-1-mjesec_3/manual"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["username"] => string(6) "Darkoc"
    ["end_date"] => string(10) "2017-11-19"
    ["_xfToken"] => string(8) "********"
  }
}
This would happen if they already have that upgrade. XenForo, shouldn't let you do that or should give a sane error message. This add-on hasn't actually done anything interesting yet in that code path.

I'll give it a try to isolate this.

I upgraded to newest version 1.3.0 and when tried to manually upgrade user this is show up (user is upgraded now)
Should be fixed now.
 
@Xon When someone has a Subscription/Recurring user upgrade, he receives an eMail every time the update is automatically renewed...

Username,
thank you for purchasing the membership upgrade named XXXXXXXXXX at XXXXXXXXXXXX.
We hope you will take advantage of and enjoy all the benefits it has to offer.
You may view your membership upgrades here.

Which is the same eMail you get if you actually purchase a one-time user upgrade or sbscription.

It would be great if there was a different eMail for subscription/recurring renewals of user upgrades. And/or an option to deactivate that entirely. So when the subscription renews you could have another eMail saying

(example)

Username,
your user upgrade named XXXXXXXXXXXXXXX renewed today. Enjoy our premium memberships.

or just no eMail as long as the subscription is maintained.
 
The templates exup_email_expiring_subscription and exup_email_expiring_upgrade are used, the default text is kinda bad.

You can adjust the phrases;
  • exup_email_expiring_user_subscription_text
  • exup_email_expiring_user_subscription_html
  • exup_email_expiring_user_upgrade_text
  • exup_email_expiring_user_upgrade_html
As required.
 
Note; due to the design of XenForo user upgrades; it is possible to receive an expired email and then a renewal email for the same user.

I blame paypal for this timing issue, but ultimately this is a design flaw of XenForo as payments for User Upgrades have no concept of "due date" separate from "apply date"
 
@Xon Seems like the text of exup_email_expiring_user_subscription_html phrase is using the master value in the Emails that are send out. Whenever I change that phrase it ignores the changes and sends out the default phrase's content.
 
Last edited:
It should be using the user's language, I'm wondering if the user has a default language (ie 0) which is being considered as the master language (ie 0)

I'll need to dig into it more
 
No it is the BCC eMail. That goes to me as admin but with an eMail address that is not related to a user. Maybe that is a hint?


But the other emails / phrases seem to work with the correct texts.
 
Something is really odd... today I got a BCC email with the Default phrases text (ALTHOUGH I have them all modified in the language the board uses) and I got both the "Expired" Email and the "Purchase" Email for a RECURRING (monthly) user upgrade.... that is very odd and confusing for the user. "Now you are out" "Now you are in"... say what?

Shouldn't there only be ONE Email for the recurring upgrade that says "Your upgrade XXXXXX has renewed today, thank you for being a premium member" (for example)... that's how I know it from all other subscription services. Receiving the "Expired" and shortly after "Purchase" Email is very odd.

EDIT: I just found out that the specific user has now TWO of the same subscriptions created... I thought that wasn't possible because I denied the upgrades for as long as they are active and the upgrade in this case is automatically recurring... so there is something really odd here and I have to investigate further...
 
Last edited:
@Freelancer as I stated before, XenForo doesn't implement a grace period between expiry and removing the upgrade. I've seen paypal take 6 hours to provide the notification they have charged, which means the user could purchase the upgrade again during this time.

I'ld recommend editing the cron task which demotes expired user promotions to run every 6 or 12 hours instead of every hour.

:edit: See this suggestion

:edit2: ok, XenForo does have a ~6 hour grace period. Yikes on how slow paypal can be!
 
Last edited:
@Xon thanks for the clarification again... I now investigated what really happened. The MONTHLY recurring upgrade is dated to charge on every first of the month. The "Upgrade Expired" Mail however was send on the 31st of October... which made the specific user impatient and he purchased a user upgrade again....

In re: to your statement: It might be okay for non-recurring upgrades to have a grace period but I find it very illogical to have a subscription where every time period you get an eMail with "You are out" and then "Your bought in again"... Is there any chance that your add-on can detect a recurring upgrade and then SKIPS the usual two emails but sends out a third type independent EMail that just states "Your upgrade XYZ has renewed today." That would leave no doubt to the user what happened and also does not get him tempted to purchase the upgrade again. I am afraid that cron task manipulation will just solve one problem but then opens new problems on other places and the two "You're Out"/"You're In" Emails do not make any sense (from the user's perspective).
 
The "expired" Email was sent at 0557 hrs and the "purchase" Email (which actually should be the "renewal" Email) was sent out on 1328 hrs same day. That makes a "grace" period of 7+ hours...!!! In the meantime the User purchased another upgrade at 0854 hrs, doubling the subscriptions with PayPal. So PayPal failed here big time.

So what would be best, to change the Cron Task for "Downgrade Expired User Upgrades" or the "Expiring User Upgrades" or both...?
 
Last edited:
So what would be best, to change the Cron Task for "Downgrade Expired User Upgrades" or the "Expiring User Upgrades" or both...?
I'ld need to check exactly what you need to fiddle with, but I think it is part of the hourly cleanup task so a code edit might be better.
 
@Xon Chris said he would extend the Grace Period to 24 hrs which should be enough. The only thing now I would ask you for is to think about if the "Expiring User Upgrades" shouldn't have a third type of eMail, that sends out (instead of the other) when the recurring subscription renews as long as it renews... pretty please... :)
 
I would love the option to disable "Notify user upon upgrade purchase" for select user upgrades (ie, recurring monthly subscriptions). I don't want to thank them every month :)

Or better, option to alert user on subscription creation, and not on subsequent renewals :)
 
I keep getting reports that the link in the expiring upgrade alert leads to a 404. I use what I think is the default phrase and version 1.3.1 ...:

Code:
{username}, your account upgrade named <i><b>{upgrade_title}</b></i> will expire in {num_days} days.<br />Thank you for having purchased this upgrade and we hope you have enjoyed the benefits it offered.<br />You may extend or renew your account upgrades <a href="{url}" class="PopupItemLink">here</a>.

The alert that the user gets is

joedoe, your account upgrade named GOLD Supporting Membership has now expired.
Thank you for having purchased this upgrade and we hope you have enjoyed the benefits it offered.
You may renew your account upgrades here.
 
Last edited:
I would love the option to disable "Notify user upon upgrade purchase" for select user upgrades (ie, recurring monthly subscriptions). I don't want to thank them every month :)

Or better, option to alert user on subscription creation, and not on subsequent renewals :)
This should only trigger on creation, not renewals. Maybe the existing upgrade is expiring, and then applying causing it to think there is no active subscription?

I keep getting reports that the link in the expiring upgrade alert leads to a 404. I use what I think is the default phrase and version 1.3.1 ...:

Code:
{username}, your account upgrade named <i><b>{upgrade_title}</b></i> will expire in {num_days} days.<br />Thank you for having purchased this upgrade and we hope you have enjoyed the benefits it offered.<br />You may extend or renew your account upgrades <a href="{url}" class="PopupItemLink">here</a>.

The alert that the user gets is

joedoe, your account upgrade named GOLD Supporting Membership has now expired.
Thank you for having purchased this upgrade and we hope you have enjoyed the benefits it offered.
You may renew your account upgrades here.
Can you check the alert_exup_expiring_upgrade and alert_exup_expiring_subscription templates and check the 'url' param sent to the phrase?

Do you have the exact link that is failing?
 
Can you check the alert_exup_expiring_upgrade and alert_exup_expiring_subscription templates and check the 'url' param sent to the phrase?

Do you have the exact link that is failing?

It's set to 'url={xen:link account/upgrades}'} in both templates.

The link as it appears in the user's alerts is
Code:
https://www.talkbass.com/%7Burl%7D


This should only trigger on creation, not renewals.
Sorry, I may have been misreading my mail log :)
 
@Xon Seems like the text of exup_email_expiring_user_subscription_html phrase is using the master value in the Emails that are send out. Whenever I change that phrase it ignores the changes and sends out the default phrase's content.
It should be using the user's language, I'm wondering if the user has a default language (ie 0) which is being considered as the master language (ie 0)

I'll need to dig into it more
No it is the BCC eMail. That goes to me as admin but with an eMail address that is not related to a user. Maybe that is a hint?


But the other emails / phrases seem to work with the correct texts.

Hmmm this is still an issue... have you had the chance to look into this, @Xon?
 
Top Bottom