Advertisement
tribulant

Find subscriber and delete subscription

Feb 27th, 2013
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. <?php
  2.  
  3. global $Db, $Subscriber, $SubscribersList;
  4.  
  5. //Find a subscriber via email
  6. $Db -> model = $Subscriber -> model;
  7. $email = 'email@domain.com'; //A valid email address
  8. $subscriber = $Db -> find(array('email' => $email));
  9.  
  10. //Remove a subscription
  11. $Db -> model = $SubscribersList -> model;
  12. $subscriber_id = $subscriber -> id; //from above $subscriber object
  13. $list_id = '3'; //The ID of the mailing list subscribed to
  14. $Db -> delete_all(array('subscriber_id' => $subscriber_id, 'list_id' => $list_id));
  15.  
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement