By Todd Hunter on Tuesday, 21 November 2017
Posted in Technical Issues
Replies 4
Likes 0
Views 697
Votes 0
I am creating new badges in my easysocial site. In my other thread "
How to create a badge for choosing to attend events" I had asked for assistance on carrying out the function. Everything was successful. This was the post from Arlex Wong

------------------
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'));
-----------------------
I am now looking to do the same thing for the command control friends.create to make a series of badges for making a number of friends.
I successfully created and installed the following:
[
{
"title" : "Acquaintance",
"description" : "Badge for Making 5 Friends",
"howto" : "To unlock this badge, you need to have made 5 friends.",
"alias" : "Acquaintance",
"extension" : "com_easysocial",
"command" : "friends.create5",
"avatar" : "media/com_easysocial/badges/acquaintance.png",
"frequency" : 5
},
{
"title" : "Friend",
"description" : "Badge for Making 10 Friends",
"howto" : "To unlock this badge, you need to have made 10 friends.",
"alias" : "Friend",
"extension" : "com_easysocial",
"command" : "friends.create10",
"avatar" : "media/com_easysocial/badges/friend.png",
"frequency" : 10
},
{
"title" : "Pal",
"description" : "Badge for Making 20 Friends",
"howto" : "To unlock this badge, you need to have made 20 friends.",
"alias" : "Pal",
"extension" : "com_easysocial",
"command" : "friends.create20",
"avatar" : "media/com_easysocial/badges/pal.png",
"frequency" : 20
},
{
"title" : "Mate",
"description" : "Badge for Making 30 Friends",
"howto" : "To unlock this badge, you need to have made 30 friends.",
"alias" : "Mate",
"extension" : "com_easysocial",
"command" : "friends.create30",
"avatar" : "media/com_easysocial/badges/mate.png",
"frequency" : 30
},
{
"title" : "Familiar",
"description" : "Badge for Making 40 Friends",
"howto" : "To unlock this badge, you need to have made 40 friends.",
"alias" : "Familiar",
"extension" : "com_easysocial",
"command" : "friends.create40",
"avatar" : "media/com_easysocial/badges/familiar.png",
"frequency" : 40
},
{
"title" : "Well Known",
"description" : "Badge for Making 50 Friends",
"howto" : "To unlock this badge, you need to have made 50 friends.",
"alias" : "Well Known",
"extension" : "com_easysocial",
"command" : "friends.create50",
"avatar" : "media/com_easysocial/badges/wellknown.png",
"frequency" : 50
},
{
"title" : "Champion",
"description" : "Badge for Making 70 Friends",
"howto" : "To unlock this badge, you need to have made 70 friends.",
"alias" : "Champion",
"extension" : "com_easysocial",
"command" : "friends.create70",
"avatar" : "media/com_easysocial/badges/champion.png",
"frequency" : 70
},
{
"title" : "Famous",
"description" : "Badge for Making 100 Friends",
"howto" : "To unlock this badge, you need to have made 100 friends.",
"alias" : "Famous",
"extension" : "com_easysocial",
"command" : "friends.create100",
"avatar" : "media/com_easysocial/badges/famous.png",
"frequency" : 100
}
]

I know need to know the syntax for the controller functions and what file it needs to be added to.
Hi Todd,

It seems you already create a ticket regarding this eh? https://stackideas.com/forums/how-to-create-badges-for-making-friends
I know need to know the syntax for the controller functions and what file it needs to be added to

-> You actually can follow the screenshot that my colleague provided in the ticket
·
Tuesday, 21 November 2017 15:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Excuse me, I completely missed that I had asked that a year ago... apologies.
·
Wednesday, 22 November 2017 05:56
·
0 Likes
·
0 Votes
·
0 Comments
·
However, upon reviewing, and in comparison to the previous code I was given, I don't see sufficient information there to create further badges...the badge .png is not mentioned, nor the name of the badge etc. In the light of the code I have listed earlier, can you please give me an example of what I should be entering as controller code into the friends.php file in the location Arlex has shown?
I am sure you can appreciate that I don't want to get this wrong and break something - as I am not really a code writer.
·
Wednesday, 22 November 2017 06:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Todd,

You actually can follow the same method that you've done in event badges on your previous ticket, just make a little tweak to make it works as example my screenshot here: http://take.ms/ZV4rg
you can add the code:
ES::badges()->log('com_easysocial', 'friends.create5', $this->requester->id, JText::_('add your message here'));

respectively according to your created badge 'friend.create10' and so on.

I'm can't help you further on full code 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.
·
Wednesday, 22 November 2017 13:47
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post