Sven Kunert
Member
Thank you! This is an awesome addition.
XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '15926-1' for key 'user_id_upgrade_id' src/XF/Db/AbstractStatement.php:230
Generated by:
Stack trace
INSERT INTO `xf_user_upgrade_active` (`user_upgrade_id`, `user_id`, `start_date`, `pay_user_id`, `is_gift`, `nf_was_gifted_for_free`, `extra`, `end_date`, `user_upgrade_record_id`, `purchase_request_key`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
------------
#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL query err...', 1062, '23000')
#1 src/XF/Db/Mysqli/Statement.php(79): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1062, '23000')
#2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(220): XF\Db\AbstractAdapter->query('INSERT INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1512): XF\Db\AbstractAdapter->insert('xf_user_upgrade...', Array, false)
#5 src/XF/Mvc/Entity/Entity.php(1244): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Service/User/Upgrade.php(172): XF\Mvc\Entity\Entity->save(true, false)
#7 src/addons/NF/GiftUpgrades/XF/Service/User/Upgrade.php(231): XF\Service\User\Upgrade->upgrade()
#8 src/addons/NF/GiftUpgrades/XF/Pub/Controller/Purchase.php(105): NF\GiftUpgrades\XF\Service\User\Upgrade->upgrade()
#9 src/addons/Kirby/PublicAccountUpgrades/XF/Pub/Controller/Purchase.php(16): NF\GiftUpgrades\XF\Pub\Controller\Purchase->actionIndex(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(352): Kirby\PublicAccountUpgrades\XF\Pub\Controller\Purchase->actionIndex(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Purchase', 'Index', Object(XF\Mvc\RouteMatch), Object(Kirby\PublicAccountUpgrades\XF\Pub\Controller\Purchase), NULL)
#12 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Kirby\PublicAccountUpgrades\XF\Pub\Controller\Purchase), NULL)
#13 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2345): XF\Mvc\Dispatcher->run()
#15 src/XF.php(512): XF\App->run()
#16 index.php(20): XF::runApp('XF\\Pub\\App')
#17 {main}
Request state
array(4) {
["url"] => string(23) "/purchase/user_upgrade/"
["referrer"] => string(74) "https://*****"
["_GET"] => array(0) {
}
["_POST"] => array(13) {
["user_upgrade_id"] => string(1) "1"
["payment_profile_id"] => string(1) "1"
["gift_for_free"] => string(1) "1"
["confirmed"] => string(1) "1"
["gift"] => string(1) "1"
["username"] => string(10) "*****"
["gift_to_user_id"] => string(5) "15926"
["content_id"] => string(5) "15926"
["content_type"] => string(4) "user"
["_xfToken"] => string(8) "********"
["_xfRequestUri"] => string(50) "/*****"
["_xfWithData"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}
I'm fairly sure this is a race condition in XenForo due to how user upgrades are handled. The add-on should handle editing a gift upgrade better however.Bug 1:
As admin I tried to gift a free membership (not anonymous) from the profile card to a user that did not have one.
Code:XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '15926-1' for key 'user_id_upgrade_id' src/XF/Db/AbstractStatement.php:230 Generated by: Stack trace INSERT INTO `xf_user_upgrade_active` (`user_upgrade_id`, `user_id`, `start_date`, `pay_user_id`, `is_gift`, `nf_was_gifted_for_free`, `extra`, `end_date`, `user_upgrade_record_id`, `purchase_request_key`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ------------ #0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL query err...', 1062, '23000') #1 src/XF/Db/Mysqli/Statement.php(79): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1062, '23000') #2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute() #3 src/XF/Db/AbstractAdapter.php(220): XF\Db\AbstractAdapter->query('INSERT INTO `x...', Array) #4 src/XF/Mvc/Entity/Entity.php(1512): XF\Db\AbstractAdapter->insert('xf_user_upgrade...', Array, false) #5 src/XF/Mvc/Entity/Entity.php(1244): XF\Mvc\Entity\Entity->_saveToSource() #6 src/XF/Service/User/Upgrade.php(172): XF\Mvc\Entity\Entity->save(true, false) #7 src/addons/NF/GiftUpgrades/XF/Service/User/Upgrade.php(231): XF\Service\User\Upgrade->upgrade() #8 src/addons/NF/GiftUpgrades/XF/Pub/Controller/Purchase.php(105): NF\GiftUpgrades\XF\Service\User\Upgrade->upgrade() #9 src/addons/Kirby/PublicAccountUpgrades/XF/Pub/Controller/Purchase.php(16): NF\GiftUpgrades\XF\Pub\Controller\Purchase->actionIndex(Object(XF\Mvc\ParameterBag)) #10 src/XF/Mvc/Dispatcher.php(352): Kirby\PublicAccountUpgrades\XF\Pub\Controller\Purchase->actionIndex(Object(XF\Mvc\ParameterBag)) #11 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Purchase', 'Index', Object(XF\Mvc\RouteMatch), Object(Kirby\PublicAccountUpgrades\XF\Pub\Controller\Purchase), NULL) #12 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Kirby\PublicAccountUpgrades\XF\Pub\Controller\Purchase), NULL) #13 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch)) #14 src/XF/App.php(2345): XF\Mvc\Dispatcher->run() #15 src/XF.php(512): XF\App->run() #16 index.php(20): XF::runApp('XF\\Pub\\App') #17 {main} Request state array(4) { ["url"] => string(23) "/purchase/user_upgrade/" ["referrer"] => string(74) "https://*****" ["_GET"] => array(0) { } ["_POST"] => array(13) { ["user_upgrade_id"] => string(1) "1" ["payment_profile_id"] => string(1) "1" ["gift_for_free"] => string(1) "1" ["confirmed"] => string(1) "1" ["gift"] => string(1) "1" ["username"] => string(10) "*****" ["gift_to_user_id"] => string(5) "15926" ["content_id"] => string(5) "15926" ["content_type"] => string(4) "user" ["_xfToken"] => string(8) "********" ["_xfRequestUri"] => string(50) "/*****" ["_xfWithData"] => string(1) "1" ["_xfResponseType"] => string(4) "json" } }
I haven't been able to reproduce the second one but there's probably some improvements that can be done for the third.Bug 2:
I went to acp Upgrades and it was given for 3 years! The upgrade itself is only 1.
Bug 3:
I clicked Edit to adjust back to 1 year and Saved. This worked but the (by __________) text was removed that shows the gift giver.
No message yet but that could be a nice addition.I see from the screenshots & description that a gift upgrade can be anonymous or not but when a gift upgrade is given can an optional message by sent to the recipient when they get the notice?
It definitely is.I haven't been able to reproduce the second one but there's probably some improvements that can be done for the third.
No message yet but that could be a nice addition.
I did another gift upgrade (free) and not anonymous. I was in a thread and did it from the member card upon hovering their name.Bug 1:
As admin I tried to gift a free membership (not anonymous) from the profile card to a user that did not have one.
Code:XF\Db\DuplicateKeyException: MySQL query error [1062]: Duplicate entry '15926-1' for key 'user_id_upgrade_id' src/XF/Db/AbstractStatement.php:230 Generated by: Stack trace INSERT INTO `xf_user_upgrade_active` (`user_upgrade_id`, `user_id`, `start_date`, `pay_user_id`, `is_gift`, `nf_was_gifted_for_free`, `extra`, `end_date`, `user_upgrade_record_id`, `purchase_request_key`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ------------ #0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL query err...', 1062, '23000') #1 src/XF/Db/Mysqli/Statement.php(79): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1062, '23000') #2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute() #3 src/XF/Db/AbstractAdapter.php(220): XF\Db\AbstractAdapter->query('INSERT INTO `x...', Array) #4 src/XF/Mvc/Entity/Entity.php(1512): XF\Db\AbstractAdapter->insert('xf_user_upgrade...', Array, false) #5 src/XF/Mvc/Entity/Entity.php(1244): XF\Mvc\Entity\Entity->_saveToSource() #6 src/XF/Service/User/Upgrade.php(172): XF\Mvc\Entity\Entity->save(true, false) #7 src/addons/NF/GiftUpgrades/XF/Service/User/Upgrade.php(231): XF\Service\User\Upgrade->upgrade() #8 src/addons/NF/GiftUpgrades/XF/Pub/Controller/Purchase.php(105): NF\GiftUpgrades\XF\Service\User\Upgrade->upgrade() #9 src/addons/Kirby/PublicAccountUpgrades/XF/Pub/Controller/Purchase.php(16): NF\GiftUpgrades\XF\Pub\Controller\Purchase->actionIndex(Object(XF\Mvc\ParameterBag)) #10 src/XF/Mvc/Dispatcher.php(352): Kirby\PublicAccountUpgrades\XF\Pub\Controller\Purchase->actionIndex(Object(XF\Mvc\ParameterBag)) #11 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Purchase', 'Index', Object(XF\Mvc\RouteMatch), Object(Kirby\PublicAccountUpgrades\XF\Pub\Controller\Purchase), NULL) #12 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Kirby\PublicAccountUpgrades\XF\Pub\Controller\Purchase), NULL) #13 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch)) #14 src/XF/App.php(2345): XF\Mvc\Dispatcher->run() #15 src/XF.php(512): XF\App->run() #16 index.php(20): XF::runApp('XF\\Pub\\App') #17 {main} Request state array(4) { ["url"] => string(23) "/purchase/user_upgrade/" ["referrer"] => string(74) "https://*****" ["_GET"] => array(0) { } ["_POST"] => array(13) { ["user_upgrade_id"] => string(1) "1" ["payment_profile_id"] => string(1) "1" ["gift_for_free"] => string(1) "1" ["confirmed"] => string(1) "1" ["gift"] => string(1) "1" ["username"] => string(10) "*****" ["gift_to_user_id"] => string(5) "15926" ["content_id"] => string(5) "15926" ["content_type"] => string(4) "user" ["_xfToken"] => string(8) "********" ["_xfRequestUri"] => string(50) "/*****" ["_xfWithData"] => string(1) "1" ["_xfResponseType"] => string(4) "json" } }
The second time I tried it it worked however, but!
Bug 2:
I went to acp Upgrades and it was given for 3 years! The upgrade itself is only 1.
Bug 3:
I clicked Edit to adjust back to 1 year and Saved. This worked but the (by __________) text was removed that shows the gift giver.
Thanks!
InvalidArgumentException: Accessed unknown getter 'PayUser' on XF:UserUpgradeExpired[11]
src/XF/Mvc/Entity/Entity.php:205
Generated by: Rene
Nov 5, 2021 at 10:19 AM
Stack trace
#0 src/XF/Mvc/Entity/Entity.php(117): XF\Mvc\Entity\Entity->get('PayUser')
#1 internal_data/code_cache/templates/l1/s0/admin/nixfifty_giftupgrades_giftedby_label.php(22): XF\Mvc\Entity\Entity->offsetGet('PayUser')
#2 src/XF/Template/Templater.php(1651): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#3 src/XF/Template/Templater.php(1680): XF\Template\Templater->renderTemplate('nixfifty_giftup...', Array)
#4 internal_data/code_cache/templates/l1/s0/admin/user_upgrade_list.php(40): XF\Template\Templater->includeTemplate('admin:nixfifty_...', Array)
#5 src/XF/Template/Templater.php(824): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#6 internal_data/code_cache/templates/l1/s0/admin/user_upgrade_list.php(242): XF\Template\Templater->callMacro('user_upgrade_li...', 'upgrade_list', Array, Array)
#7 src/XF/Template/Templater.php(1651): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#8 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('user_upgrade_li...', Array)
#9 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#10 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XF:UserUpgrade\\...', 'admin:user_upgr...', Array)
#11 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#14 src/XF/App.php(2345): XF\Mvc\Dispatcher->run()
#15 src/XF.php(512): XF\App->run()
#16 admin.php(13): XF::runApp('XF\\Admin\\App')
#17 {main}
- Allow recurring upgrades to be gifted. The first term will be paid for by the gifter and the giftee can choose to renew upon its expiration.
- Expose Recent Gift Post's widget date limit as a configurable option.
- Add missing relation to the UserUpgradeExpired entity.
- Fix potential issues surrounding the giving of free gifts.
Just made purchased. I also think that a conversation is a much better option than alert, do consider adding this option.I'm thinking a conversation would be better so the alert does not get buried, dismissed, or disappear with more alerts.
Anyway, top work! Really like it so far.
We use essential cookies to make this site work, and optional cookies to enhance your experience.