Guest User

Untitled

a guest
Mar 23rd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2. function listen_to_mepr_events($event) {
  3. $obj = $event->get_data();
  4. //$obj might be a MeprTransaction object or a MeprSubscription object
  5.  
  6. if(!($obj instanceof MeprTransaction) && !($obj instanceof MeprSubscription)) {
  7. return; // nothing here to do if we're not dealing with a txn or sub
  8. }
  9.  
  10. $member = $obj->user();
  11.  
  12. if($member->is_active_on_membership($obj)) {
  13. //member is active on membership
  14. }
  15. else {
  16. //member is no longer active on this membership
  17. }
  18. }
  19. add_action('mepr-event-create', 'listen_to_mepr_events');
Add Comment
Please, Sign In to add comment