By paul lewis on Thursday, 29 January 2015
Posted in General Issues
Likes 0
Views 794
Votes 0
Ive downloaded the badge example in documentation but when i edit it and try to discover it it does not show up, i wonder if there is a template u guys have that i can use that is assigned only and not earned, idk but i think im missing something, when i discover it it does show up that it was discovered it just doesnt show up as a new acheivement. i even tried copying one of the stock badges that comes with easysocial and edited it to be different and it still doesnt show up . please help Please help
Where did you place this file? If there's a syntax error on the json string, it could be problematic. Try placing the codes at http://jsonlint.com and see if it validates fine.
·
Thursday, 29 January 2015 02:33
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok with this code:
[
{
// The title of the badge.
"title" : "Owner of FTL",

// 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" : "owner of FTL",

// 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/owner.png",

// When user creates a new discussion for 150 times.
"frequency" : 150
}



Im getting this error
Parse error on line 2:
[ { //Thetitleofthebadge
--------------^
Expecting 'STRING', '}'
·
Thursday, 29 January 2015 02:37
·
0 Likes
·
0 Votes
·
0 Comments
·
what command should it be, and does the frequency need to be different?
·
Thursday, 29 January 2015 02:40
·
0 Likes
·
0 Votes
·
0 Comments
·
i want a command that only an admin can assign the badge please
·
Thursday, 29 January 2015 02:46
·
0 Likes
·
0 Votes
·
0 Comments
·
I used this code which is a valid json and it still doesnt show up in my badges list ???
[
{
"title": "FTL Owner",
"alias": "story-teller",
"description": "An owner of FTL",
"howto": "Be promoted to owner",
"command": "story.create",
"extension": "com_easysocial",
"avatar": "media/com_easysocial/badges/owner.png",
"frequency": 30000000
}
]
·
Thursday, 29 January 2015 02:55
·
0 Likes
·
0 Votes
·
0 Comments
·
Your command and extension has to be unique. If you place a command and extension that already exists on the badge list, nothing would happen. The command is used as an identifier when you place the php codes as outlined on http://docs.stackideas.com/developers/achievements/logging
·
Thursday, 29 January 2015 02:59
·
0 Likes
·
0 Votes
·
0 Comments
·
that did it thanks so much
·
Thursday, 29 January 2015 03:04
·
0 Likes
·
0 Votes
·
0 Comments
·
HI Paul,

May I know is your issue is now resolved?

Please advise.
·
Thursday, 29 January 2015 10:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Paul, i'm in the same situation.
Even when reading all the posts and the developers docs it's still unclear.
Maybe it would be great if someone made a definitive guide.

So we have to do 2 things.

1st the badge file:

[
{
"title" : "Donation",
"description" : "Some description of your badge",
"howto" : "To unlock this badge, you need to do something.",
"alias" : "donate",
"extension" : "com_easysocial", > needs to be unique?
"command" : "admin.task.manual", > needs to be unique?
"avatar" : "media/com_easysocial/badges/donate.png",
"frequency" : 1
}
]


Upload the file via the installer... (i get this: SocialTableBadge::bind(*NULL*) )

2nd add code to php

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


Where do i put the php code in? Should i add it to com_easysocial.php?
Am i missing something?

Kind regards

Kjell
·
Thursday, 29 January 2015 18:54
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Kjell Provost,

I'm really sorry that delayed of this reply,
1st the badge file:

[
{
"title" : "Donation",
"description" : "Some description of your badge",
"howto" : "To unlock this badge, you need to do something.",
"alias" : "donate",
"extension" : "com_easysocial", > needs to be unique?
"command" : "admin.task.manual", > needs to be unique?
"avatar" : "media/com_easysocial/badges/donate.png",
"frequency" : 1
}
]

"extension" - this is based on which extension you use for this badge. Example : I create my own badge and use for Easysocial, so need to inset this "com_easysocial"
"command" - Yes, you have to put this unique command for your badge, if the command you put already existing in one of your badge, then it will get failed.

Once you done above thing, you have to add this in your php file.

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

By the way, may i know how the user can get this achievement? At the same time, if you can, provide us with your badge file.
·
Friday, 30 January 2015 12:18
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Arlex, no problem on the small delay

I've sent you the badge file.
The badge is meant to give to users who did their first track&field competition.
I would like to give a second badge when they do 10 competitions etc...
All badge would be given manually.

So actually, if i make a second badge, the command has to be unique again.
As for inserting the code into php, which php file do you mean.
Sorry for all those questions

Kind regards

Kjell
·
Friday, 30 January 2015 20:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

When you create a new ".badge" file, all it does is to register the new commands into EasySocial. You will also need to log this down when the user performs the action on your extension. EasySocial does not know when the user did their first track and field competition.

You can learn more about logging the action here, http://docs.stackideas.com/developers/achievements/logging
·
Saturday, 31 January 2015 12:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Kjell Provost ,

I am really sorry for the delay of this reply as it is a weekend for us here.

Yes, based on what Mark said that the EasySocial does not know when the user did their first track and field competition. So you have to explain to us how the user did their first track and field competition in your Easysocial, then we can provide the proper suggestion regarding this.

By the way, regarding when you install your new badge hitting that issues :
I have checked in your badge file, it seems like you put that quote symbol is not correct, check my screenshot below.
And try download my attachment file and try install from your Easysocial > badge > install , it should be able to install now.
·
Saturday, 31 January 2015 12:20
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Arlex and Mark,

Thank you both for the reply and for correcting the badge file.
Well the badge would be given manually by the admin who, only himself, keeps track of the track and field competitions of an athlete.
This data will not be registered online in Easysocial.

So the corrected badge looks like: (i translated it now)

[
{
"title" : "1st competition badge",
"description" : "This badge shows that you have participated at a competition.",
"howto" : "You earn the badge when you participate at a competition.",
"alias" : "Comp1",
"extension" : "com_easysocial",
"command" : "admin.task.manual",
"avatar" : "media/com_easysocial/badges/gym-icon.png",
"frequency" : 1
}
]


So, is the logging still needed and should it look like this?

require_once( JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php' );

// @badge: admin.task.manual
Foundry::badges()->log( 'com_easysocial' , 'admin.task.manual' , $userId , JText::_( 'Did a competition' ) );


The logging should be added to foundry.php file?

Again, many many thanks.
Feeling a little bit stupid right now

Kjell
·
Saturday, 31 January 2015 16:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Good news...
I was indeed able to install the badge and i could give it to an athlete.
Without adding the log.

MANY MANY thanks

Kjell
·
Saturday, 31 January 2015 18:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for updating, glad that your issues are resolved now
·
Sunday, 01 February 2015 14:44
·
0 Likes
·
0 Votes
·
0 Comments
·
but still as i only want to add some badges and i don`t have an extension to embed the Logging Achievement Actions where else can i add the code? can i add the code in the file where the default easisocial badges are? if yes, which file is that?
thank you!
·
Friday, 20 March 2015 16:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Bogdan,

When you create a new badge, you can't just assign them to the user. The user needs to perform some actions which you will then add the code to log their actions. This is the workflow of the achievements in EasySocial
·
Saturday, 21 March 2015 00:34
·
0 Likes
·
0 Votes
·
0 Comments
·
then how the default badges work? can`t i just create a badge, install it and work like the others? btw the badges that i want to install are not for the existing users.
·
Saturday, 21 March 2015 04:21
·
0 Likes
·
0 Votes
·
0 Comments
·
We actually have to add the necessary php codes to reward users when they perform specific actions. Until the system detects that they performed the x amount of actions, they will then receive the award.
·
Saturday, 21 March 2015 17:24
·
0 Likes
·
0 Votes
·
0 Comments
·
so if i install this badge


[
{
"title" : "Just a title",
"alias" : "just-an-alias",
"description" : "Some description",
"howto" : "Like this and that",
"command" : "after.seven.posts",
"extension" : "com_easysocial",
"avatar" : "media/com_easysocial/badges/seventh-badge.png",
"frequency" : 15
}
]


wouldn`t the user receive the award after he performes the amount of actions? without adding any additional php code.
·
Saturday, 21 March 2015 20:24
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Bogdan,

In order for the actions to logged into the system, you need to add the php codes as well. EasySocial wouldn't know what "after.seven.posts" is and there is no way for it to know unless you tell it to with the php codes.
·
Sunday, 22 March 2015 13:24
·
0 Likes
·
0 Votes
·
0 Comments
·
but is weird, as u said "The user needs to perform some actions which you will then add the code to log their actions."
i`m confused because i have to add the code when the user performes the actions and not before.
can`t i just install the badge, add the code and after x actions user gets the award?
isn`t that how the default badges work?
·
Monday, 23 March 2015 19:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Bogdan,

Sorry for late reply to this,
Let's me do a simple explanation one of the Easysocial existing badge called "Chatter - Loves to chat with users on the site."

[
{
"title" : "COM_EASYSOCIAL_BADGES_CHATTER_TITLE",
"alias" : "chatter",
"description" : "COM_EASYSOCIAL_BADGES_CHATTER_DESC",
"howto" : "COM_EASYSOCIAL_BADGES_CHATTER_HOWTO",
"command" : "conversation.reply",
"extension" : "com_easysocial",
"avatar" : "media/com_easysocial/badges/chatter.png",
"frequency" : 150
}
]

Once you created this badge file, you have to write php code like following code in JoomlaFolder\administrator\components\com_easysocial\models\conversations.php under this function addReply: (Badge command 'conversation.reply' is important part)

// @badge: conversation.reply
$badge = FD::badges();
$badge->log( 'com_easysocial' , 'conversation.reply' , $creatorId , JText::_( 'COM_EASYSOCIAL_CONVERSATIONS_BADGE_REPLIED_IN_A_CONVERSATION' ) );


In other word, when the user reply in conversation over 150 times, so this user will get the chatter badges.
·
Tuesday, 24 March 2015 02:05
·
0 Likes
·
0 Votes
·
0 Comments
·
ok. now i want to create a badge that the user would be awarded after x posts, like story teller badge. where do i put the code?
·
Tuesday, 24 March 2015 03:38
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Bogdan,

Sorry for late reply to this,

You can add this code in this file -> JoomlaFolder\components\com_easysocial\controllers\story.php

//LINE 289
// @badge: after.seven.posts
$badge->log('com_easysocial', 'after.seven.posts', $this->my->id, JText::_('COM_EASYSOCIAL_YOUR_OWN_LANGUAGE_STRING));

Hope this help.
·
Tuesday, 24 March 2015 13:40
·
0 Likes
·
0 Votes
·
0 Comments
·
Great.
It`s all good now. Thank you for the support.
·
Wednesday, 25 March 2015 02:52
·
0 Likes
·
0 Votes
·
0 Comments
·
No problem, glad that your issues are resolved now.
·
Wednesday, 25 March 2015 02:56
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post