materio_user_rules.module 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Implement hook_user()
  4. *
  5. */
  6. function materio_user_rules_user_update(&$edit, $account) {
  7. if (!empty($account->logintoboggan_email_validated)) {
  8. if($subscriber = simplenews_subscriber_load_by_mail($account->mail)){
  9. foreach($subscriber->newsletter_subscription as $tid => $subscription){
  10. $term = taxonomy_term_load($tid);
  11. $subscriptions_text_array[] = $term->name;
  12. $subscriptions_tids[] = $tid;
  13. }
  14. $subscriptions_text = implode(', ', $subscriptions_text_array);
  15. $args = array(
  16. 'account' => $account,
  17. 'subscriptions_list' => $subscriptions_tids,
  18. 'subscriptions_text' => $subscriptions_text,
  19. );
  20. rules_invoke_event_by_args('materio_logintoboggan_validated', $args);
  21. }
  22. }
  23. }
  24. /**
  25. * Implements hook_simplenews_unsubscribe_user().
  26. */
  27. function materio_user_rules_simplenews_subscribe_user($subscriber, $subscription) {
  28. if (!empty($subscriber->logintoboggan_email_validated)) {
  29. $args = array(
  30. 'mail' => $subscriber->mail,
  31. 'tid' => $subscription->tid,
  32. );
  33. // rules_invoke_event_by_args('simplenews_rules_event_subscribe', $args);
  34. }
  35. }