Badges

Badges 1.0.6

No permission to download

Faust

Well-known member
Hi again @CMTV , I have a small issue with this addon on UIX TH theme, badges featured aren’t displayed on post bit on messages. Any advice or fixes?
 

CMTV

Well-known member
Confirmed working on XF 2.2!

@FaustVasea I did not test this addon on UIX TH, but I believe you need to go message_macros template, find something that looks like userExtras and place the following code there:

HTML:
<xf:if is="{{ property('CMTV_Badges_show_in_message') }}">
    <xf:css src="CMTV_Badges_featured_badges.less" />
    
    <xf:macro name="featured_badges" template="CMTV_Badges_featured_badges_macros"
              arg-location="message" arg-user="{$user}" />
</xf:if>
 

Faust

Well-known member
Confirmed working on XF 2.2!

@FaustVasea I did not test this addon on UIX TH, but I believe you need to go message_macros template, find something that looks like userExtras and place the following code there:

HTML:
<xf:if is="{{ property('CMTV_Badges_show_in_message') }}">
    <xf:css src="CMTV_Badges_featured_badges.less" />
   
    <xf:macro name="featured_badges" template="CMTV_Badges_featured_badges_macros"
              arg-location="message" arg-user="{$user}" />
</xf:if>

Where about?

A got this 2 lines:

<xf:if is="{{ property('uix_collapseExtraInfo')}}">
<div class="thThreads__message-userExtras">
</xf:if>
<div class="message-userExtras">
 

Gemma

Well-known member
Where about?

A got this 2 lines:

<xf:if is="{{ property('uix_collapseExtraInfo')}}">
<div class="thThreads__message-userExtras">
</xf:if>
<div class="message-userExtras">
This might still work

 

Dirtydan1974

New member
Everything else is good, just can’t get the badges to show below the avatar. Tried putting the code in a couple different places with no results.
any ideas? Here’s where I have it now....

</xf:if>
87
</xf:if>
88
</xf:contentcheck>
89

90
</div>
91
</xf:if>
92
</xf:if>
93
<span class="message-userArrow"></span>
94
</section>
95
</xf:macro>
96
<xf:if is="{{ property('CMTV_Badges_show_in_message') }}">
97
<xf:css src="CMTV_Badges_featured_badges.less" />
98

99
<xf:macro name="featured_badges" template="CMTV_Badges_featured_badges_macros"
100
arg-location="message" arg-user="{$user}" />
101
</xf:if>
102
<xf:macro name="user_info_simple" arg-user="!" arg-fallbackName="">
103
<header itemscope itemtype="https://schema.org/Person" class="message-user">
104
<meta itemprop="name" content="{{ $user.username ?: $fallbackName }}">
105
<div class="message-avatar">
106
<div class="message-avatar-wrapper">
107
<xf:avatar user="$user" size="s" defaultname="{$fallbackName}" itemprop="image" />
108
</div>
109
</div>
110
<span class="message-userArrow"></span>
111
</header>
112
</xf:macro>
113
 

koraldon

Member
Thanks for this add-on, still testing it but works great from first look.
Is it possible to add a color attribute for the font awesome icons as part of the add-on?
I see there is a css class, but that will probably mean css edits which I prefer not to perform.

Also, just a tip for those who are looking to allow users to awards badges to themselves - You can setup a badge with a user criteria of having a field with a choice of that badge. So the user updates his profile, checks that box and than he gets the badge.
 
Many errors on PHP 7.4 on XF 2.1

  • ErrorException: Template error: Cannot call method getFeaturedBadges on a non-object (NULL)
  • src/XF/Template/Templater.php:984
#0 [internal function]: XF\Template\Templater->handleTemplateError()
#1 src/XF/Template/Templater.php(984): trigger_error()
#2 internal_data/code_cache/templates/l2/s2/public/CMTV_Badges_featured_badges_macros.php(16): XF\Template\Templater->method()
#3 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}()
#4 internal_data/code_cache/templates/l2/s2/public/message_macros.php(200): XF\Template\Templater->callMacro()
#5 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}()
#6 internal_data/code_cache/templates/l2/s2/public/post_macros.php(27): XF\Template\Templater->callMacro()
#7 src/XF/Template/Templater.php(701): XF\Template\Templater->{closure}()
#8 internal_data/code_cache/templates/l2/s2/public/thread_view.php(536): XF\Template\Templater->callMacro()
#9 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}()
#10 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate()
#11 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#12 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView()
#13 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView()
#14 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply()
#15 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render()
#16 src/XF/App.php(2191): XF\Mvc\Dispatcher->run()
#17 src/XF.php(391): XF\App->run()
#18 index.php(20): XF::runApp()
#19 {main}
 

Bulbagarden

Active member
We're having troubles in getting the system to automatically give people their badges when usergroup criteria is met. Sometimes it works fine, other times it just won't give them the badge at all.

We've also been totally unable to remove badges from people once they've been awarded. The system won't do it automatically when their usergroups no longer match the requirements set for the badge, and no badge moderation functions are available on user's profile pages at all.

Anyone else having either of these issues?
 

Faust

Well-known member
We're having troubles in getting the system to automatically give people their badges when usergroup criteria is met. Sometimes it works fine, other times it just won't give them the badge at all.

We've also been totally unable to remove badges from people once they've been awarded. The system won't do it automatically when their usergroups no longer match the requirements set for the badge, and no badge moderation functions are available on user's profile pages at all.

Anyone else having either of these issues?

I’m not experienced none of issues reported by you. Works smoothly on my site. I don’t know how will work on xf2.2
 

TFW

Active member
I would suggest to change two lines in CMTV_Badges_featured_badges.less, so the last row would be also centered.

Old version:
CSS:
.featuredBadges
{
    display: grid;
ePyaQPP.png

New version:
CSS:
.featuredBadges
{
    display: flex;
    flex-wrap: wrap;
kCdlGkh.png
 

alv4

Member
I have some questions:
1. On 2.2 on default theme awards aren't appearing on the user tooltip. How to use it?
2. I want the awards to be shown on messages at the bottom of the details. Which template should I edit ?
 

JoyFreak

Well-known member
The add-on seems to work OK. I was just wondering if there's a way to stop the emails every time a user gets a badge? It could get real spammy.
 

koraldon

Member
We have done a manual edit to disable the emails.

@CMTV Did you look into compatibility with 2.2.?
I understand others also have an issue with the tooltip in 2.2, it also happened on my test board.
 

Maa

Member
Hi,

Great mod! Not sure why it's not paid? Anyway to show appreciation via patron or buying a coffee for your something? :)

I have an issue with this mod, please see:

PHP:
ErrorException: [E_WARNING] file_put_contents(/home/x/public_html/internal_data/code_cache/templates/l1/s0/public/helper_js_global.php): failed to open stream: Permission denied in src/vendor/league/flysystem/src/Adapter/Local.php at line 199
XF::handlePhpError()
file_put_contents() in src/vendor/league/flysystem/src/Adapter/Local.php at line 199
League\Flysystem\Adapter\Local->update() in src/vendor/league/flysystem/src/Filesystem.php at line 99
League\Flysystem\Filesystem->put()
call_user_func_array() in src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php at line 431
League\Flysystem\EventableFilesystem\EventableFilesystem->callFilesystemMethod() in src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php at line 395
League\Flysystem\EventableFilesystem\EventableFilesystem->delegateMethodCall() in src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php at line 57
League\Flysystem\EventableFilesystem\EventableFilesystem->put() in src/vendor/league/flysystem/src/MountManager.php at line 597
League\Flysystem\MountManager->put() in src/XF/Util/File.php at line 197
XF\Util\File::writeToAbstractedPath() in src/XF/Service/Template/Compile.php at line 146
XF\Service\Template\Compile->writeCompiled() in src/XF/Service/Template/Compile.php at line 43
XF\Service\Template\Compile->recompile() in src/XF/Entity/Template.php at line 433
XF\Entity\Template->_postSave() in src/XF/Mvc/Entity/Entity.php at line 1266
XF\Mvc\Entity\Entity->save() in src/XF/Entity/TemplateModification.php at line 95
XF\Entity\TemplateModification->reparseModification() in src/XF/Entity/TemplateModification.php at line 145
XF\Entity\TemplateModification->_postSave() in src/XF/Mvc/Entity/Entity.php at line 1266
XF\Mvc\Entity\Entity->save() in src/XF/AddOn/DataType/TemplateModification.php at line 79
XF\AddOn\DataType\TemplateModification->importAddOnData() in src/XF/Job/AddOnData.php at line 110
XF\Job\AddOnData->run() in src/XF/Job/Manager.php at line 258
XF\Job\Manager->runJobInternal() in src/XF/Job/Manager.php at line 200
XF\Job\Manager->runJobEntry() in src/XF/Job/Manager.php at line 116
XF\Job\Manager->runByIds() in src/XF/Admin/Controller/Tools.php at line 120
XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 350
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2300
XF\App->run() in src/XF.php at line 465
XF::runApp() in admin.php at line 13
 

JoyFreak

Well-known member
For those asking to disable the emails:


This can be done via editing the plugin file Repository/UserBadge.php. You just need to comment the following:

Code:
$params = [
'user' => $user,
'reason' => $reason,
'badge' => $this->finder(C::__('Badge'))->whereId($badgeId)->fetchOne()
];

/* COMMENT THIS
$this->app()->mailer()->newMail()
->setToUser($user)
->setTemplate(C::_('badge_award'), $params)
->queue();
*/

$user->fastUpdate('cmtv_badges_badge_count', $user->cmtv_badges_badge_count + 1);

Just ignore "File check" error about this edit.
 

gogo

Well-known member
I'm using this add-on to replace the built-in trophies, but.. badges won't be displayed by themselves, only after featured by users. That doesn't make sense.
 
Top