By Todd Hunter on Friday, 13 January 2017
Posted in General
Likes 0
Views 180
Votes 0
I want to encourage my social community to indicate their intention to attend an event. So I would like to create some badges for that activity.
Is there any documentation available around how to do that?
I think you can refer on this documentation : https://stackideas.com/docs/easysocial/developers/achievements

But after you create that badge rule, you have to add some php code into controller file which perform the attend function, so system can log how many times that user attend the event before.
·
Friday, 13 January 2017 10:47
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you Arlex, so can you assist me any further with regard to the php code. I am officially out of my depth. I actually thought badge creation might have been a "click some boxes" in the EasySocial app.
·
Friday, 13 January 2017 10:59
·
0 Likes
·
0 Votes
·
0 Comments
·
You're welcome.

Because the badge rules file is only identify what is that badge unique id, once you install this badge rule file into Easysocial system, it actually need some php code to perform when this new badge suppose to do his job. e.g. When someone attend the event.

By the way, I am really sorry but unfortunately we cannot accommodate your request currently as it is beyond our support scope's policy as outlined in http://stackideas.com/support

Having said that, if you require us to perform the customization for you, you can always request for a quote from us at https://crm.stackideas.com and select "Customizations" . Our sales person would be glad to send you a quote for the customizations that you have requested.
·
Friday, 13 January 2017 11:31
·
0 Likes
·
0 Votes
·
0 Comments
·
So what would be the controller function? This would be in the controller file "command". So if I want to count and reward badges for each time someone marks that they are attending an event... what command is that going to be? How do I find it?
·
Friday, 13 January 2017 12:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Would the command be something as simple as event.attend?
·
Friday, 13 January 2017 12:21
·
0 Likes
·
0 Votes
·
0 Comments
·
OK so I found the command for myself: events.going
·
Friday, 13 January 2017 12:53
·
0 Likes
·
0 Votes
·
0 Comments
·
I have created the .badge file (shown below) with a name of attendance.badge and I have uploaded the appropriate images. Easy social shows discoveries, but none of the new badges appear. And when I attempt instead to install the file, it tells me the .badge file is an invalid format.

So either my syntax in the file is wrong. the file name is wrong - or your process is wrong.

[

{

"title" : "Good Attender",

"description" : "Badge for Attending 5 Events",

"howto" : "To unlock this badge, you need to have marked on 5 events that you are attending.",

"alias" : "Good Attender",

"extension" : "com_easysocial",

"command" : "event.attend",

"avatar" : "media/com_easysocial/badges/goodattender.png",

"frequency" : 5

},
{

"title" : "Great Attender",

"description" : "Badge for Attending 10 Events",

"howto" : "To unlock this badge, you need to have marked on 10 events that you are attending.",

"alias" : "Great Attender",

"extension" : "com_easysocial",

"command" : "events.going",

"avatar" : "media/com_easysocial/badges/greatattender.png",

"frequency" : 10

},


{

"title" : "Super Attender",

"description" : "Badge for Attending 20 Events",

"howto" : "To unlock this badge, you need to have marked on 20 events that you are attending.",

"alias" : "Super Attender",

"extension" : "com_easysocial",

"command" : "events.going",

"avatar" : "media/com_easysocial/badges/superattender.png",

"frequency" : 20

},


{

"title" : "Marvellous Attender",

"description" : "Badge for Attending 50 Events",

"howto" : "To unlock this badge, you need to have marked on 50 events that you are attending.",

"alias" : "Marvellous Attender",

"extension" : "com_easysocial",

"command" : "events.going",

"avatar" : "media/com_easysocial/badges/marvellousattender.png",

"frequency" : 50

},


{

"title" : "Master Attender",

"description" : "Badge for Attending 100 Events",

"howto" : "To unlock this badge, you need to have marked on 100 events that you are attending.",

"alias" : "Master Attender",

"extension" : "com_easysocial",

"command" : "events.going",

"avatar" : "media/com_easysocial/badges/masterattender.png",

"frequency" : 10
0
},


{

"title" : "Amazing Attender",

"description" : "Badge for Attending 200 Events",

"howto" : "To unlock this badge, you need to have marked on 200 events that you are attending.",

"alias" : "Amazing Attender",

"extension" : "com_easysocial",

"command" : "events.going",

"avatar" : "media/com_easysocial/badges/amazingattender.png",

"frequency" : 200
},


{

"title" : "Stupendous Attender",

"description" : "Badge for Attending 300 Events",

"howto" : "To unlock this badge, you need to have marked on 300 events that you are attending.",

"alias" : "Stupendous Attender",

"extension" : "com_easysocial",

"command" : "events.going",

"avatar" : "media/com_easysocial/badges/stupendousattender.png",

"frequency" : 300

}


]
·
Friday, 13 January 2017 13:20
·
0 Likes
·
0 Votes
·
0 Comments
·
1. There seems to be an issue with your badge contents, http://take.ms/itB5S

2. You cannot install a badge that has the same command which already exists on the database. If there is already a badge for a particular rule, you cannot just duplicate it.
·
Saturday, 14 January 2017 15:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Based on what my colleague mentioned that is correct, one of your `frequency` value is not enter correct the format then causing this issue.

You can also can refer my sample .badge file from my attached file below, you can extract it and check those command you have to put different and match with following the coding.

And that controller function you have look for this file in order to implement your new badge.

JoomlaFolder/administrator/components/com_easysocial/tables/eventguest.php

Please refer on my attached screenshot and see which line of code you suppose to add in.


// Assign badge for the user
$badge = ES::badges();
$badge->log('com_easysocial', 'event.attend', $this->uid, JText::_('add your message here'));
$badge->log('com_easysocial', 'events.going', $this->uid, JText::_('add your message here'));
$badge->log('com_easysocial', 'events.goingsuper', $this->uid, JText::_('add your message here'));
$badge->log('com_easysocial', 'events.goingmarvellous', $this->uid, JText::_('add your message here'));
$badge->log('com_easysocial', 'events.goingmaster', $this->uid, JText::_('add your message here'));
$badge->log('com_easysocial', 'events.goingamazing', $this->uid, JText::_('add your message here'));
$badge->log('com_easysocial', 'events.goingstupendous', $this->uid, JText::_('add your message here'));
·
Saturday, 14 January 2017 15:33
·
0 Likes
·
0 Votes
·
0 Comments
·
Arlex,

I installed the file you attached and yes the badges installed correctly . However when I attempted to add the control functions as shown in your sample and the screenshot to the eventguest.php file, it broke easy social.
I removed the lines you suggested and added the file back to the site and everything worked again. Is is possible that your functions are incorrect?
·
Monday, 16 January 2017 09:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Can you attach to me that eventguest.php file which you modified so I can check it for you.
·
Monday, 16 January 2017 11:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Actually I managed to get the file successfully updated... There was a typo in the lines I added.
·
Monday, 16 January 2017 13:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for letting us to know your issue has been resolved now.

As a gentle reminder, kindly start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiry. I will lock and mark this thread as resolved.
·
Monday, 16 January 2017 15:19
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post