Skip to Content Skip to Menu

CB notifications: Create custom notifications based off asset

  • timstohr
  • timstohr
  • OFFLINE
  • Posts: 1091
  • Thanks: 56
  • Karma: 9
6 years 8 months ago #301926 by timstohr
Hi Kyle,
I would like to take your GroupJive Notification Auto action and transform it so that it everytime an activity entry with asset groupjive.group.xx.events is created, it notifies all the people inside the group.

What I need to do for that is simply change (or introduce) a condition that basically fires only when the asset groupjive.group.%.events.% is created (then I can do the rest myself).

How do I do that?
Which var do I have to condition against?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 8 months ago #301954 by krileon
There is already a notification for GJ Event creation built into CB GroupJive via Email or Private Message that you can force to a CB Activity notification by enabling the "CB GroupJive Events - Create Notification" system action.

The trigger used be "CB Groupjive - Stream Notification" is only executed when someone directly posts activity on a stream. Activity generated stores directly with activity_onAfterCreateActivity. activity_onAfterCreateActivity does not contain the source or stream objects. It only contains the activity object as var1. So you'd need to change all the var3 usages to var1 and in your conditions condition [var1_asset] using REGEX to ensure its a GJ event activity entry.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • timstohr
  • timstohr
  • OFFLINE
  • Posts: 1091
  • Thanks: 56
  • Karma: 9
6 years 8 months ago #302072 by timstohr
Hi Kyle,
Having problems since I cannot even get the system to output a notification. Creation of an event in a third party component creates an activity with asset groupjive.group.27.event.970 (the digits can vary but the letters cannot).

I have set up the following auto Action:
GENERAL
Triggers: activity_onAfterCreateActivity
Type: CB Activity
User: Custom
USER
Code:
if ( ! preg_match( '/^groupjive\.group\.(\d+)/', '[var3_asset]', $matches ) ) { return null; } global $_CB_database; $query = 'SELECT ' . $_CB_database->NameQuote( 'user_id' ) . "\n FROM " . $_CB_database->NameQuote( '#__groupjive_users' ) . "\n WHERE " . $_CB_database->NameQuote( 'group' ) . " = " . (int) $matches[1] . "\n AND " . $_CB_database->NameQuote( 'status' ) . " >= 1" . "\n AND " . $_CB_database->NameQuote( 'user_id' ) . " != " . (int) \CBLib\Application\Application::MyUser()->getUserId(); $_CB_database->setQuery( $query ); return $_CB_database->loadResultArray();
CONDITIONS
[var1_published] Equal To 1
[vari_asset] is REGEX /^groupjive\.group\.\d\d\.event\./
ACTION
Mode: Notification
Method: Create
Asset: [var1_asset].activity.[var1_id].events
Title: has created an event
Owner: [var1_user_id]
User: [action_user]
Date: [var1_date]
Load by: By ASset, Owner and User
OUTPUT
Display: none
PARAMETERS:
Translate: Yes
Substitutions: Yes

What am I doing wrong?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 8 months ago #302084 by krileon

Creation of an event in a third party component creates an activity with asset groupjive.group.27.event.970 (the digits can vary but the letters cannot).

This is probably why it doesn't work, but I don't know. I can't help you with all your custom usages, sorry. Enable debug mode and maximum error reporting in Joomla then in your auto action enable debug and it'll try to queue messages to Joomlas message queue if something fails due to configuration error, access check, or condition.

There is a notification already built in as a system action that is sent to group users when an event is created. It even allows them to set themselves to not be notified using the notification page built into GJ. Just publish "CB GroupJive Events - Create Notification" system action and you're done, this is tested working. I've no idea if this will work with your usage though, but likely not.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum