1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Manually applying user upgrade fails if upgrade would extend current upgrade

Discussion in 'Troubleshooting and Problems' started by shawn, Apr 23, 2012.

  1. shawn

    shawn Well-Known Member

    If a user doesn't currently have that upgrade... no problem. Enter their username and it applies as it should. If manually upgrading them would extend their current upgrade, I get this error:

    Additionally, as more of a feature request than an actual bug, there's no place in the ACP to manually edit a user's upgrade settings. You can use the "active upgrades" pane to see when an upgrade is supposed to expire, but because it's not searchable, it's basically useless if you have more than a few dozen active subscriptions.
  2. shawn

    shawn Well-Known Member

    Any reason I shouldn't manually change the end_date field in the db?
  3. trilogy33

    trilogy33 Well-Known Member

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I am unable to reproduce this error.

    This looks like it might be due to corrupt data in xf_user_upgrade_active.extra. Can you post the results of this query?

    SELECT CONVERT(uua.extra USING utf8)
    FROM xf_user_upgrade_active AS uua;
    Or give me access to phpmyadmin and I can have a look for myself.
  5. shawn

    shawn Well-Known Member

    The vast majority just say "Array"... which I'm assuming are the ones we imported from vB. The bottom several rows are more like "a:4:{s:11:"cost_amount";s:4:", etc.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    "Array" is not valid. That explains the error.

    The vB importer doesn't do paid subs. Did you use this addon?


    I just reviewed the code for that addon and found the problem:

    					'user_id' => $userIdMap[$log['userid']],
    					'user_upgrade_id' => $newId,
    					'start_date' => $log['regdate'],
    					'extra' => 'Array',
    					'end_date' => $log['expirydate'],
    Try running this query to fix your data:

    UPDATE xf_user_upgrade_active
    SET extra = 'a:0:{}'
    WHERE extra = 'Array';
    Let me know if that fixes the error.
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Actually, we need to fill in the array indexes. Hold off on that query...
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Upload this script to your forum root and run it from your browser. That will rebuild the 'extra' data for those records.

    That should fix the errors. Let me know.

    Attached Files:

  9. shawn

    shawn Well-Known Member

    Jake, I owe you a beer. The db fields are now fixed, upgrades from the ACP work properly, and we should probably link your script to the importers with the bad queries.

    *However*, my bug should now be revised somewhat:

    Let's say we've got a user that has an active upgrade, set to expire next March (03/15/2013 for the sake of discussion). Now, I don't know *when* their upgrade expires, because it doesn't show in the admincp. It theoretically shows under the "List Active Upgrades" link in the ACP, but because that list isn't searchable, and I have several hundred entries in it, for all intents and purposes, the list is useless... and the upgrade info isn't exposed in the edit user page.

    SO... our user mentioned above won a prize and gets a free year subscription. I select "Manually Upgrade User" from the Upgrades pane, type in the username, and down at the bottom, it says that the upgrade ends on 2013-05-28, which is a year from today. Problem is, if I hit okay, rather than adding a year to the current upgrade, it explicitly sets the upgrade to expire on 5-28-13, or only about two and a half months after it was scheduled to end in the first place.

    Either way, I'm still better off changing the expiration date directly within the database, as I can quickly search by user_id and directly modify the expiration date.

    As far as bugs go, it probably doesn't fall under 'unintended behavior', but that doesn't mean it works well the way it's currently designed.

    Thanks again for the help.
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  11. shawn

    shawn Well-Known Member

Share This Page