Helpdesk

I have updated the default EasySocial Polls to include (3) badges for Polls.

The badges included are for the following triggers:
- Poll Creation
- Commenting on a Poll
- Reacting to a Poll

You will want to add the following code below (EasySocial 3.2.21):

ROOT > media > com_easysocial > apps > users > polls > polls.php(Add a new Line at 418) just below the following:

// Only notify if the actor is not the poll's owner
if ($likes->created_by != $stream->actor_id) {
ES::notify('likes.item', array($stream->actor_id), false, $systemParams);
}



Replace the code above with the following:

// Only notify if the actor is not the poll's owner
if ($likes->created_by != $stream->actor_id) {
ES::notify('likes.item', array($stream->actor_id), false, $systemParams);
}

ES::badges()->log('com_easysocial', 'polls.react', $likes->created_by, '');



In the same file, we need to add the trigger for reactions. (Add a new Line at 478) just below the following:

// Notify the owner of the photo first
if ($comment->created_by != $polls->created_by) {
ES::notify('comments.item', array($polls->created_by), $mailParams, $systemParams);
}


Replace the code above with the following:

// Notify the owner of the photo first
if ($comment->created_by != $polls->created_by) {
ES::notify('comments.item', array($polls->created_by), $mailParams, $systemParams);
}

ES::badges()->log('com_easysocial', 'polls.comment', $comment->created_by, '');



We need to edit one more file here:
ROOT > administrator > components > com_easysocial > includes > polls > polls.php (Add line 291) just below the following:

// Insert the poll options
if ($template->items) {

foreach ($template->items as $item) {

$pollItem = ES::table('PollsItems');
$pollItem->poll_id = $table->id;
$pollItem->value = $item->text;
$pollItem->count = 0;

$pollItem->store();
}
}

ES::points()->assign('polls.add', 'com_easysocial', $this->my->id);


Replace the code above with the following:

// Insert the poll options
if ($template->items) {

foreach ($template->items as $item) {

$pollItem = ES::table('PollsItems');
$pollItem->poll_id = $table->id;
$pollItem->value = $item->text;
$pollItem->count = 0;

$pollItem->store();
}
}

ES::points()->assign('polls.add', 'com_easysocial', $this->my->id);
ES::badges()->log('com_easysocial', 'polls.create', $this->my->id, '');



I have attached a file called (polls.badge) you will need to go to the EasySocial backend and install it in Achievements:
SITE ADMIN > Components > EasySocial > Achievements > Install > select the attached file and install

Next, you will need to upload the badge images to the folder: ROOT > media > com_easysocial > badges

Lastly you will need to either add language overrides to your site for the language strings, or update the language strings in the badges in EasySocials admin panel.

My hope is that StackIdeas will incorporate this in the next public release of EasySocial. If I missed anything I apologize, I am not a programmer. I would HIGHLY encourage anyone who wants to use these hacks to take a backup of their site first, and I would recommend testing on a development server first.

Thank you,
James
Attachments (2)
Attachments can only be downloaded by logged in users

This section can only be seen by users with a valid subscription.
If you have a valid subscription, please login now

Your time
Stack Ideas HQ
Support is
Offline

It is currently off working hours and most of us aren't around.

Rest assured that we will get back to your issues as soon as the day starts tomorrow!

Buy Us Coffee

Are you happy with our support and would like to buy us a cup of coffee?

$
Enjoy the Coffee!
Service via PayPal
Subscribe for product updates & promotions