Feature proposal #5788
closedImplement additional variables for push triggers
Description
The current push triggers are missing the $user and $viewer objects making it difficult to tell who the recipient is.
Updated by krileon about 8 years ago
They should also include @mentions array of user ids. This way actions can be performed such as notifications to a mentioned user. This should probably just be a function in the activity and comment table classes.
Updated by krileon almost 8 years ago
Replace the push triggers with new before and after usages as follows.
$_PLUGINS->trigger( 'activity_onBeforePushComment', array( &$stream, &$row, &$object ) );
$_PLUGINS->trigger( 'activity_onAfterPushComment', array( $stream, $row, $object ) );
The idea here is plugins will act on activity_onBeforePushComment and depending on what is being commented on for example the plugin can rebuild an object and set it to $object. This will allow acting on activity_onAfterPushComment and sending notifications (needed for push notifications usage) the owner of the object being commented on. For example this is absolutely necessary in the case of gallery activity otherwise we only have "gallery.photos.PHOTO_ID" to work with.
Updated by krileon almost 8 years ago
This has been updated even further using the below usages.
$_PLUGINS->trigger( 'activity_onBeforeUpdateStreamActivity', array( $stream, $source, &$row, $old ) );
$_PLUGINS->trigger( 'activity_onBeforeCreateStreamActivity', array( $stream, $source, &$row ) );
$_PLUGINS->trigger( 'activity_onAfterUpdateStreamActivity', array( $stream, $source, $row, $old ) );
$_PLUGINS->trigger( 'activity_onAfterCreateStreamActivity', array( $stream, $source, $row ) );
If the entry is profile.USER_ID, activity.ACTIVITY_ID, or comment.COMMENT_ID it'll automatically build and set $source to those objects. Otherwise plugins are responsible for building $source. If a comment is made on an activity entry it should have the appropriate $source as well (a lot of cases it'll be activity.ACTIVITY_ID) so you'll be able to notify the activity owner for example.
The update triggers also send the previous object so you can do comparisons if you want. Note these are ONLY for push notifications (e.g. frontend user create usage).
Please can build the source with the following triggers.
$_PLUGINS->trigger( 'activity_onCommentSource', array( $this, &$source ) );
$_PLUGINS->trigger( 'activity_onActivitySource', array( $this, &$source ) );
Updated by krileon almost 8 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100