By JH on Saturday, 14 December 2013
Posted in General Issues
Replies 14
Likes 0
Views 2.6K
Votes 0
Hi guys,

How can I create my own badges? I'd like to assign them manually, not based on site activity.

Suggestions?

Thank you!

James
Hi JH,

I am sorry for the delay of this reply as now is a weekend for us here

To create your own badges for your EasySocial, you might want to take a look at our documentation here:

http://docs.stackideas.com/developers/achievements/achievements
http://docs.stackideas.com/developers/points/points

Hope this help and have a nice day
Sam
·
Saturday, 14 December 2013 14:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you, Sam. I have studied the pages you sent me. I still have one question: how do I set up a rule so that a badge is assigned manually, not based on site activity? In other words, what is the "command" syntax for a manually-assigned badge? Here is what I have so far in my rule:

[
{
// The title of the badge.
"title" : "Manual Badge 1",

// The description of the badge
"description" : "This badge is assigned manually by the admin",

// The steps needed to unlock this badge.
"howto" : "To earn this badge you must do something.",

// The alias of the badge.
"alias" : "Manual1",

// The extension for this badge.
"extension" : "com_easysocial",

// The badge command.
"command" : "???????",

// The default avatar for this rule. Relative to the site's document root a.k.a (JPATH_ROOT)
"avatar" : "media/com_easysocial/badges/manual1.png",

// When user creates a new discussion for 15 times.
"frequency" : ????????
}
]


What should the "???????" in the example above be? Thank you for your help!

James
JH
·
Thursday, 19 December 2013 01:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi James,

I am sorry for the delay of this reply.

For the command, you will need to put a unique command for your badge so that in php code, you can assign your badge by calling this command. Treat this command as the action to your badge. The command should look something like below:


"command" : "admin.task.manual"


You can give any value to your command as long you understand that the command do by looking at the value Later on, you will need to call your command in php by doing this:


$badge = Foundry::badges();
$badge->log( 'com_easysocial' , 'admin.task.manual' , $user_id , 'Manually assigned by admin.' );



As for the frequency, it is the 'threshold' of how many time a user perform the action to obtain the badge. E.g.

"frequency"		: 10


Above means, in order for a user to obtain your badge, the user has to perform at least 10 times the actions


one question: how do I set up a rule so that a badge is assigned manually, not based on site activity?

The above is a 'standard' for creating a badge. If you want to manually assign a badge to user, you first install the badge into EasySocial so that you will get the badge id ( you can view the id from badge listing. Then do a mass assignment to users for a particular badge id by using the csv file Please see http://screencast.com/t/G4uXxAH6w7o

Hope this help and have a nice day
Sam
·
Thursday, 19 December 2013 11:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Sam,

No apology necessary; your support is amazing. I follow everything EXCEPT for where to use the php code. Sorry, I'm slow. Where do I put this code in order to call the badge?

$badge 	= Foundry::badges();
$badge->log( 'com_easysocial' , 'admin.task.manual' , $user_id , 'Manually assigned by admin.' );


You're very patient, thank you!

James
JH
·
Thursday, 19 December 2013 15:06
·
0 Likes
·
0 Votes
·
0 Comments
·
I'm gonna guess it's in the file root/administrator/components/com_easysocial/includes/badges/badges.php

Am I right? If so, how does the new badge code integrate into that file?

Thanks again,

James
JH
·
Thursday, 19 December 2013 15:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi James,

If you want to manually assign the badge to your user, what you can do is to use the mass assignment of your badge. This way, your user will not need to perform any action and there is no code integration needed

if you want to assign the badge only when your user perform certain action, e.g. when they login to your site, then you will need to add that code in your php file. When i say 'your php file', this mean the php file in your plugin or component, or, you can hack EasySocial to integration that code

Hope this help and have a nice day
Sam
·
Thursday, 19 December 2013 15:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you! That's solved it. I appreciate your help very much.

James
JH
·
Friday, 20 December 2013 05:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi James,

You are welcome. Glad to hear your issue now resolved
Have a nice day
Sam
·
Friday, 20 December 2013 10:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi how would we make the badge be assigned when a user signs up under a certain profile type?
What would be the command for that?
·
Sunday, 22 March 2015 00:52
·
0 Likes
·
0 Votes
·
0 Comments
·
You need to create the following since this isn't in the core:

1. New badge rule
2. Add the php code into the registration controller so that when a new user registers, add a new logging for achievements on the site.
·
Sunday, 22 March 2015 04:46
·
0 Likes
·
0 Votes
·
0 Comments
·
I made a new rule for the badges and they show up in the badges listing with the custom commands i made for them. What folder do i go into to to add the php code and what type of code should be put into there to make it add the badge to certain profile types?
·
Sunday, 22 March 2015 06:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Derrick,

It looks like your subscription has expired and in order for you to continue requesting for support, you will need an active subscription. If you have already renewed, please let us know so that we can correct this for your account.

Thank you for understanding.
·
Sunday, 22 March 2015 13:11
·
0 Likes
·
0 Votes
·
0 Comments
·
hi , where i can find the badge avatar folder ?? i want to replaced with a costume avatar
·
Friday, 16 October 2015 02:01
·
0 Likes
·
0 Votes
·
0 Comments
·
What do you mean by badges avatar? Do you mean the badges image files? It is located in /media/com_easysocial/badges
·
Friday, 16 October 2015 02:36
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post