By Brent Williams on Saturday, 13 June 2020
Posted in Technical Issues
Replies 2
Likes 0
Views 504
Votes 0
Hi,

I'd like to write a plugin for a client site that will make an API call to Mautic on certain EasySocial events, with the intention that the client can create marketing campaigns to encourage user engagement within EasySocial. I see that the component has a hook for users joining a group:

$dispatcher->trigger('user', 'onJoinGroup', array($this->my->id, $group));

In file:

./components/com_easysocial/controllers/groups.php, line 1406

Can I access this hook through the Joomla! system event handling (e.g. with a plugin in the 'plugins' folder)? If not, how do I register a handler for that hook?

And would it be possible for StackIdeas to consider adding hooks for users following other users, and for friend invitations when they are accepted?

Thank you.
Also - how do I add an activity item to the activity stream in EasySocial via a plugin? Is there an API documented for EasySocial? If you have any code example it would be great, thank you.
·
Saturday, 13 June 2020 07:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Brent,

The hooks in EasySocial works for apps in EasySocial as well as plugins. It depends on what you want to achieve. If your app needs to generate an activity stream as well, I suggest that you work on the app in EasySocial instead of a plugin. You can take a look at the existing apps located in /media/com_easysocial/apps/user/ on how you could create the app as I believe a live example would be the best example.

Once you have the app, you just need to create a function onJoinGroup in your app's file which is pretty similar to what Joomla plugin does. The only difference is we do not bloat the plugin namespace in Joomla with so many apps.

If you want to use a Joomla plugin to listen to the onJoinGroup trigger, it would also be possible. All you need to do is to define a function in your plugin as onJoinGroupUser
·
Saturday, 13 June 2020 11:03
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post