Feature proposal #8315
closedFamily Plans: implement triggers for accepting shared subscriptions
Description
This should allow extending the accept checks so a shared subscription can have custom conditions applied to it or custom behavior after a shared subscription has been accepted.
Updated by krileon almost 4 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Implemented in MR !224
The following triggers have been implemented.
$_PLUGINS->trigger( 'familyplans_onCanAcceptSharedSub', array( &$this, $userId, $subscription ) )
$_PLUGINS->trigger( 'familyplans_onBeforeAcceptSharedSub', array( &$this, $user, $subscription ) )
$_PLUGINS->trigger( 'familyplans_onAfterAcceptSharedSub', array( $this, $user, $subscription ) )
$_PLUGINS->trigger( 'familyplans_onAfterDeleteSharedSub', array( $this, $user, $subscription ) )
These can be used to add custom behavior to the shared subscription process. onCanAcceptSharedSub can be used to add custom conditions to block accepting a subscription (simply return false in trigger usage to block the accept). onBeforeAcceptSharedSub can be used to modify the shared subscription before accepting or adding custom conditions (again, simply return false). onAfterAcceptSharedSub can be used to add custom behavior after a shared subscription has been fully accepted (e.g. add custom usergroups, change field values, etc..). onAfterDeleteSharedSub can be used to reverse any changes made by onAfterAcceptSharedSub when a shared subscription is deleted/cancelled.