[VersoBit] Badges [Deleted]

VersoBit

Well-known member
OpenSocial Preview.webp

VersoBit submitted a new resource:
[VersoBit] Badges - Reward your users with collectible badges, and control how your users get them.

View attachment 239848
Reward your users with collectible badges, and control how your users get them.

This release is intended to start the next fork of this project for development, branding of this addon has changed, but it is a drop-in replacement for "Badges" by @CMTV
Features
  • Award users badges based on criteria.
  • Manually award...

Read more about this resource...

v1.0.7: Initial Release
This version is a drop-in replacement for CMTV-Badges.
Expect to see branding changes on the addon, it will be renamed from "Badges" to "[VersoBit] Badges"

Change Log​

  • Missing Phrase: alert_opt_out.badge_award #6
  • Stop checking for badges if user is deleted #7
  • Honor User Preferences for Email Notifications #8
  • Globally Disable Email Notifications #9
  • Badges are not assigned to users who have not been recently active #10
  • CSS flex instead of grid for featuredBadges class #15
 
Last edited:
Very glad to see this addon being supported again. We had problems with the previous CMTV-1.0.6, where it wasn't adding/removing badges correctly based on people's usergroups. Hoping this new release will resolve that issue.
 
Very glad to see this addon being supported again. We had problems with the previous CMTV-1.0.6, where it wasn't adding/removing badges correctly based on people's usergroups. Hoping this new release will resolve that issue.
There was no changes to anything related to criteria, so if there are any issues - please let me know!
 
Thank you for bringing back one of the best free addons to the life! Just to make sure - it's enough to upgrade the old addon?

Soon I will come back with ideas for the new features.
 
Thank you for bringing back one of the best free addons to the live! Just to make sure - it's enough to upgrade the old addon?

Soon I will come back with ideas for the new features.
You should be able to upgrade from CMTV-1.0.6 without issue
 
Would be nice to add kind of shop so members can buy badges with credits (DragonByte). I think this could be very useful.
 
Happy London GIF by Don't Hate The Playaz

How to upgrade from cmtv badges? Just install?

also would love to see ability to set color for font awesome badges
 
Would be nice to add kind of shop so members can buy badges with credits (DragonByte). I think this could be very useful.
I don't think I would implement something like this, I feel it takes away from what Badges are meant to be.

How to upgrade from cmtv badges? Just install?

also would love to see ability to set color for font awesome badges
Great idea, ill add that to our list(if you don't have GitHub)

For install, as mentioned above - This is a drop-in replacement for CMTV-Badges v1.0.6; You should be able to upgrade from CMTV-1.0.6 without issue.
 
We could look at adding a hook for other developers to use that could assign something (or de-assign) when called; Ill add it to the git for future consideration.

I've already made a suggestion on dragon byte tech website.

My suggestion is similar to Reddit badges.
 
When my Cron runs to update badges, it triggers errors and not sure why. Any suggestions?

Code:
ErrorException: [E_WARNING] Invalid argument supplied for foreach() src/addons/ThemeHouse/UserCriteria/Listener/CriteriaUser.php:748
Generated by: Unknown account Nov 18, 2020 at 5:07 PM
Stack trace
#0 src/addons/ThemeHouse/UserCriteria/Listener/CriteriaUser.php(748): XF::handlePhpError(2, '[E_WARNING] Inv...', '/home/gamermob/...', 748, Array)
#1 [internal function]: ThemeHouse\UserCriteria\Listener\CriteriaUser::criteriaUser('th_min_forum_th...', Array, Object(NF\GiftUpgrades\XF\Entity\User), false)
#2 src/XF/Extension.php(67): call_user_func_array(Array, Array)
#3 src/XF/App.php(2797): XF\Extension->fire('criteria_user', Array, NULL)
#4 src/XF/Criteria/User.php(64): XF\App->fire('criteria_user', Array)
#5 src/XF/Criteria/AbstractCriteria.php(63): XF\Criteria\User->isUnknownMatched('th_min_forum_th...', Array, Object(NF\GiftUpgrades\XF\Entity\User))
#6 src/addons/CMTV/Badges/Cron/Badge.php(55): XF\Criteria\AbstractCriteria->isMatched(Object(NF\GiftUpgrades\XF\Entity\User))
#7 [internal function]: CMTV\Badges\Cron\Badge::runBadgeCheck(Object(XF\Entity\CronEntry))
#8 src/XF/Job/Cron.php(34): call_user_func(Array, Object(XF\Entity\CronEntry))
#9 src/XF/Job/Manager.php(258): XF\Job\Cron->run(G)
#10 src/XF/Job/Manager.php(200): XF\Job\Manager->runJobInternal(Array, G)
#11 src/XF/Job/Manager.php(84): XF\Job\Manager->runJobEntry(Array, G)
#12 job.php(43): XF\Job\Manager->runQueue(false, 8)
#13 {main}
Request state
array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(21) "https://gamermob.com/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

Code:
ErrorException: [E_NOTICE] Undefined index: nodes src/addons/ThemeHouse/UserCriteria/Listener/CriteriaUser.php:748
Generated by: Unknown account Nov 18, 2020 at 5:07 PM
Stack trace
#0 src/addons/ThemeHouse/UserCriteria/Listener/CriteriaUser.php(748): XF::handlePhpError(8, '[E_NOTICE] Unde...', '/home/gamermob/...', 748, Array)
#1 [internal function]: ThemeHouse\UserCriteria\Listener\CriteriaUser::criteriaUser('th_min_forum_th...', Array, Object(NF\GiftUpgrades\XF\Entity\User), false)
#2 src/XF/Extension.php(67): call_user_func_array(Array, Array)
#3 src/XF/App.php(2797): XF\Extension->fire('criteria_user', Array, NULL)
#4 src/XF/Criteria/User.php(64): XF\App->fire('criteria_user', Array)
#5 src/XF/Criteria/AbstractCriteria.php(63): XF\Criteria\User->isUnknownMatched('th_min_forum_th...', Array, Object(NF\GiftUpgrades\XF\Entity\User))
#6 src/addons/CMTV/Badges/Cron/Badge.php(55): XF\Criteria\AbstractCriteria->isMatched(Object(NF\GiftUpgrades\XF\Entity\User))
#7 [internal function]: CMTV\Badges\Cron\Badge::runBadgeCheck(Object(XF\Entity\CronEntry))
#8 src/XF/Job/Cron.php(34): call_user_func(Array, Object(XF\Entity\CronEntry))
#9 src/XF/Job/Manager.php(258): XF\Job\Cron->run(G)
#10 src/XF/Job/Manager.php(200): XF\Job\Manager->runJobInternal(Array, G)
#11 src/XF/Job/Manager.php(84): XF\Job\Manager->runJobEntry(Array, G)
#12 job.php(43): XF\Job\Manager->runQueue(false, 8)
#13 {main}
Request state
array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(21) "https://gamermob.com/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
I've got some errors, but it's nothing new (it happens on previous versions too):

  • XF\Db\Exception: Macro public:CMTV_Badges_featured_badges_macros :: featured_badges() error: MySQL query error [1615]: Prepared statement needs to be re-prepared
  • src/XF/Db/AbstractStatement.php:228
  • Generated by: User1
  • Nov 18, 2020 at 10:13 AM

Stack trace​

SELECT cache_value
FROM xf_permission_combination
WHERE permission_combination_id = ?

------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1615, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1615, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(150): XF\Db\AbstractAdapter->query('
SELECT cach...', 354)
#4 src/XF/PermissionCache.php(32): XF\Db\AbstractAdapter->fetchOne('
SELECT cach...', 354)
#5 src/XF/PermissionSet.php(35): XF\PermissionCache->getGlobalPerms(354)
#6 src/XF/Entity/User.php(926): XF\PermissionSet->hasGlobalPermission('CMTV_Badges', 'manageFeatured')
#7 src/addons/CMTV/Badges/Repository/UserBadge.php(101): XF\Entity\User->hasPermission('CMTV_Badges', 'manageFeatured')
#8 src/addons/CMTV/Badges/Repository/UserBadge.php(80): CMTV\Badges\Repository\UserBadge->getAllowedFeaturedBadges(Object(SV\WarningImprovements\XF\Entity\User))
#9 src/addons/CMTV/Badges/XF/Entity/User.php(80): CMTV\Badges\Repository\UserBadge->getFeaturedUserBadges(Object(SV\WarningImprovements\XF\Entity\User))
#10 [internal function]: CMTV\Badges\XF\Entity\User->getFeaturedBadges()
#11 src/XF/Template/Templater.php(999): call_user_func_array(Array, Array)
#12 internal_data/code_cache/templates/l3/s6/public/CMTV_Badges_featured_badges_macros.php(19): XF\Template\Templater->method(Object(SV\WarningImprovements\XF\Entity\User), 'getFeaturedBadg...', Array)
#13 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Array)
#14 internal_data/code_cache/templates/l3/s6/public/message_macros.php(58): XF\Template\Templater->callMacro('CMTV_Badges_fea...', 'featured_badges', Array, Array)
#15 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Array)
#16 internal_data/code_cache/templates/l3/s6/public/post_macros.php(40): XF\Template\Templater->callMacro('message_macros', 'user_info', Array, Array)
#17 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Array)
#18 internal_data/code_cache/templates/l3/s6/public/thread_view.php(647): XF\Template\Templater->callMacro('post_macros', 'post', Array, Array)
#19 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array)
#20 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('thread_view', Array)
#21 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#22 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:thread_v...', Array)
#23 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#24 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#25 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#26 src/XF/App.php(2191): XF\Mvc\Dispatcher->run()
#27 src/XF.php(391): XF\App->run()
#28 index.php(20): XF::runApp('XF\\Pub\\App')
#29 {main}

Request state​

array(4) {
["url"] => string(30) "/threads/1287/"
["referrer"] => string(30) "https://forum.exampleForum.com/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}

  • XF\Db\Exception: Macro public:CMTV_Badges_featured_badges_macros :: featured_badges() error: MySQL query error [1615]: Prepared statement needs to be re-prepared
  • src/XF/Db/AbstractStatement.php:228
  • Generated by: User2
  • Nov 18, 2020 at 10:18 AM

Stack trace​

SELECT xf_cmtv_badges_user_badge., xf_cmtv_badges_badge_Badge_1.
FROM xf_cmtv_badges_user_badge
LEFT JOIN xf_cmtv_badges_badge AS xf_cmtv_badges_badge_Badge_1 ON (xf_cmtv_badges_badge_Badge_1.badge_id = xf_cmtv_badges_user_badge.badge_id)
LEFT JOIN xf_cmtv_badges_badge_category AS xf_cmtv_badges_badge_category_Category_2 ON (xf_cmtv_badges_badge_category_Category_2.badge_category_id = xf_cmtv_badges_badge_Badge_1.badge_category_id)
WHERE (xf_cmtv_badges_user_badge.user_id = 33973) AND (xf_cmtv_badges_user_badge.featured = 1)
ORDER BY xf_cmtv_badges_badge_category_Category_2.display_order ASC, xf_cmtv_badges_badge_Badge_1.display_order ASC

LIMIT 6
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1615, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1615, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Mvc/Entity/Finder.php(1294): XF\Db\AbstractAdapter->query('
SELECT `xf_...')
#4 src/addons/CMTV/Badges/Repository/UserBadge.php(96): XF\Mvc\Entity\Finder->fetch()
#5 src/addons/CMTV/Badges/XF/Entity/User.php(80): CMTV\Badges\Repository\UserBadge->getFeaturedUserBadges(Object(SV\WarningImprovements\XF\Entity\User))
#6 [internal function]: CMTV\Badges\XF\Entity\User->getFeaturedBadges()
#7 src/XF/Template/Templater.php(999): call_user_func_array(Array, Array)
#8 internal_data/code_cache/templates/l3/s6/public/CMTV_Badges_featured_badges_macros.php(19): XF\Template\Templater->method(Object(SV\WarningImprovements\XF\Entity\User), 'getFeaturedBadg...', Array)
#9 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Array)
#10 internal_data/code_cache/templates/l3/s6/public/message_macros.php(58): XF\Template\Templater->callMacro('CMTV_Badges_fea...', 'featured_badges', Array, Array)
#11 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Array)
#12 internal_data/code_cache/templates/l3/s6/public/post_macros.php(40): XF\Template\Templater->callMacro('message_macros', 'user_info', Array, Array)
#13 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, Array)
#14 internal_data/code_cache/templates/l3/s6/public/thread_view.php(647): XF\Template\Templater->callMacro('post_macros', 'post', Array, Array)
#15 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array)
#16 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('thread_view', Array)
#17 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#18 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XF:Thread\\View', 'public:thread_v...', Array)
#19 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#20 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#21 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#22 src/XF/App.php(2191): XF\Mvc\Dispatcher->run()
#23 src/XF.php(391): XF\App->run()
#24 index.php(20): XF::runApp('XF\\Pub\\App')
#25 {main}

Request state​

array(4) {
["url"] => string(39) "/threads/20193/page-3"
["referrer"] => string(68) "https://forum.exampleForum.com/threads/20193/page-2"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
When my Cron runs to update badges, it triggers errors and not sure why. Any suggestions?
If you disable "[TH] User Criteria Extended" does this stop?
Do you have any badges that are using parameters from this add-on?

I've got some errors, but it's nothing new (it happens on previous versions too):
Are these errors happening in the CRON environment, or on your ACP/Frontend?
Do you have any additional plugins installed in your test environment?
Xon's Warning Improvements might be causing this issue (just a hunch).

Something else I just noticed:
MySQL query error [1615]: Prepared statement needs to be re-prepared
Are you in a shared hosting environment? if so, you could be reaching the upper limit of the table_definition_cache, You cannot increase this variable in a shared environment usually.
 
Last edited:
  • Like
Reactions: TFW
Hello, is criterias include solutions ?
I assume you are asking if you can set criteria on badges?

You can set criteria on various options, statuses/stats, user states, etc; You can also award badges based upon the users entries on their personal profile details. See ACP screenshots as attached for examples of some of the options you can use. These will be awarded to users when the CRON function runs and validates your criteria against the users.

1605740892136.png1605741002252.png
 
Last edited:
Thank you for your answer but in fact I wanted to know if it was possible to assign badges based on the number of solutions found by users in the question forums. It seems that not given the attachments.
 
Thank you for your answer but in fact I wanted to know if it was possible to assign badges based on the number of solutions found by users in the question forums. It seems that not given the attachments.
You should have the option to either set them when the user has answered at least X questions, or has answered no more than X questions; see attached.
1605741588163.webp
 
Top Bottom