By sky on Tuesday, 29 April 2014
Posted in General Issues
Replies 16
Likes 0
Views 1.1K
Votes 0
I am creating some custom badges, and don't know how to create the rule for "extension","command" and "frequency" for below use cases:

1. assign badge when an user created over 30 easyblog articles in blog category A.
2. assign badge when an user answer over 30 easydiscuss questions.
3. assign badge when an user answer over 30 easydiscuss questions in category A.
4. assign badge when an user upload over 300 photos to easysocial
5. assign badge when an user submit over 30 reviews to jreview listings.


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

// The description of the badge
"description" : "Some description of your badge",

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

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

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

// The badge command.
"command" : "conversation.create",

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

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

Have you read our online documentation on how you can create your own badge? If not, then maybe you should take a look first at http://docs.stackideas.com/developers/achievements/achievements

Hope this help and have a nice day
Sam
·
Tuesday, 29 April 2014 16:35
·
0 Likes
·
0 Votes
·
0 Comments
·
yes, I did read the doc, but still don't know how to handle these use cases.
sky
·
Tuesday, 29 April 2014 17:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Sky,

Once you created these rules, you need to scan the rules so that they are logged into the system. This is only the first phase of creating custom rules. The second phase requires that you write php codes to assign the actions whenever the user performs the action to achieve a badge.

By the way, if you just want to modify the requirements to achieve badges, you can just edit the badge and change your requirements
·
Wednesday, 30 April 2014 03:34
·
0 Likes
·
0 Votes
·
0 Comments
·
I want to know if below rules are already available to use or need to write php codes for them? can you give codes for them?

1. assign badge when an user created over 30 easyblog articles in blog category A.
2. assign badge when an user answer over 30 easydiscuss questions.
3. assign badge when an user answer over 30 easydiscuss questions in category A.
4. assign badge when an user upload over 300 photos to easysocial
sky
·
Wednesday, 30 April 2014 09:59
·
0 Likes
·
0 Votes
·
0 Comments
·
There are rules for #2 and #4 but for #1 and #3, we do not have this yet.
·
Wednesday, 30 April 2014 11:21
·
0 Likes
·
0 Votes
·
0 Comments
·
so can you kindly post out the rules for #2 and #4

and create the rules for for #1 and #3 please?

I believe many users will benefit from it.
sky
·
Wednesday, 30 April 2014 12:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

Sorry but I don't really get what you mean by posting out the rules? They are already in the system
·
Wednesday, 30 April 2014 16:22
·
0 Likes
·
0 Votes
·
0 Comments
·
sorry, I am new to easysocial. if they are already in place, how can I know what to put in the rule file for "extension","command" ? where can I check these info?

how to create the rules for for #1 and #3?
sky
·
Wednesday, 30 April 2014 17:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

These rules are already installed by default. You can find it under Badges
·
Wednesday, 30 April 2014 23:42
·
0 Likes
·
0 Votes
·
0 Comments
·
How to create rules for these two?

1. assign badge when an user created over 30 easyblog articles in blog category A.
3. assign badge when an user answer over 30 easydiscuss questions in category A.
sky
·
Thursday, 01 May 2014 10:51
·
0 Likes
·
0 Votes
·
0 Comments
·
To create custom rules, you need to:

1. Create the .badge file as pointed out by Sam earlier, http://docs.stackideas.com/developers/achievements/achievements . After creating it, run a rule discovery at the badges area.

2. Insert the PHP codes to log the badge achievement whenever user performs a specific action. You should take a look at the existing codes in EasyBlog in /components/com_easyblog/helpers/easysocial.php
·
Thursday, 01 May 2014 12:18
·
0 Likes
·
0 Votes
·
0 Comments
·
Mark, thanks for the reply. As I am not familiar with easyblog and coding, I wonder if it is possible you can kindly help to create one example php codes for below rule so that I can reproduce the rest categories.

assign badge when an user created over 30 easyblog articles in blog category A
sky
·
Thursday, 01 May 2014 12:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Mark, thanks for the reply. As I am not familiar with easyblog and coding, I wonder if it is possible you can kindly help to create one example php codes for below rule so that I can reproduce the rest categories.

assign badge when an user created over 30 easyblog articles in blog category A
sky
·
Thursday, 01 May 2014 12:34
·
0 Likes
·
0 Votes
·
0 Comments
·
I am really sorry but this is way beyond our support scope as outlined in http://stackideas.com/support . You should take a look at the examples that are already included with EasyBlog.
·
Thursday, 01 May 2014 12:36
·
0 Likes
·
0 Votes
·
0 Comments
·
To create custom rules, you need to:

1. Create the .badge file as pointed out by Sam earlier, http://docs.stackideas.com/developers/achievements/achievements . After creating it, run a rule discovery at the badges area.

2. Insert the PHP codes to log the badge achievement whenever user performs a specific action. You should take a look at the existing codes in EasyBlog in /components/com_easyblog/helpers/easysocial.php

in the reference to your reply which is given above:
i couldn't find any sample PHP code to log the badge achievement whenever user performs a specific action.

Could you please provide me the correct link where i can see any sample PHP code for the same.
·
Monday, 13 April 2015 16:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Torry,

There are actually quite number of ways to assign the badge in easysocial. You can refer to pur sample code from your /components/com_easysocial/controllers/photos.php at line 918 where the badge will be assigned to user whenever the photo is being tagged. Below is the sample code:

$photo->assignBadge( 'photos.tag' , $my->id );
·
Monday, 13 April 2015 19:13
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post