Project

General

Profile

Actions

Feature proposal #5788

closed

Implement additional variables for push triggers

Added by krileon about 8 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
15 February 2016
Due date:
% Done:

100%

Estimated time:

Description

The current push triggers are missing the $user and $viewer objects making it difficult to tell who the recipient is.

Actions #1

Updated by krileon over 7 years ago

  • Target version changed from 754 to 4.0.0
Actions #2

Updated by krileon over 7 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.

Actions #3

Updated by krileon over 7 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.

Actions #4

Updated by krileon about 7 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 ) );

Actions #5

Updated by krileon about 7 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by krileon about 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF