Jump to content

Code hook for new activity

Featured Replies

Posted

Is there a hook for new activity?
I would like to write a plugin that fires after an activity happend.

 

What kind of activity?

For content item/comment/review things there are often "processAfterEdit" and similar methods you could hook in to, and for member account changes there's the MemberSync extensions. Basically, it depends on what activity you want to "listen" for the best approach to do so.

  • Author

Any kind of activity that appears in the activity stream.
I would like to mirror the activity stream in a telegram channel.

The activity stream shows new content, comments and reviews, new reactions, and optionally several other things as configured in the AdminCP (such as profile changes and new registrations).

Capturing all of these things would require hooks on different areas of code (such as MemberSync extensions to capture when the account is created and when the profile is updated, as well as hooks on the content item classes to capture when the content is created).

Backing up - what exactly do you plan to do when the data is captured? Are you intending to push the data to a remote service, or just use it locally with the software? Because another approach might be to just use our stream classes to load and output a stream manually using different templates.

  • Author

I created a Telegram channel and a Telegram bot for my community.
I'd like you have a activity stream telegram channel.
If I could use an activity stream hook for new entries it would be easy to send the new entry to the telegram channel too.

Well, I guess your best bet will be to hook into the areas I mentioned and start passing over the data one by one.

For content, items are placed into the search index so you can listen for this event with a hook and push the data to your remote service.

For other activity points (like changing profile data or registering), you can create hooks on the MemberSync class.

There won't be one central point to push everything, since some stream content is pulled when the stream is output rather than when those actions occur, but you can build off of these concepts to add more things (like reaction issued).

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.