2

is there a way to find how many users unsubscribed from my Simplenews newsletter at my Drupal-7 website? And, if yes, can I detect from which particular newsletter did the user unsubscribe from?

2

You can click admin/people/simplenews and check on status column. OR you can use following code to get the data

  // fetching from the database.
  $query = db_select('simplenews_subscriber', 'ss');
  $query->innerJoin('simplenews_subscription', 'si', 'si.snid = ss.snid');
  $query->fields('ss', array('mail'))
    ->condition('ss.activated', $condition_active)
    ->condition('si.status', $condition_subscribed)
    ->condition('si.newsletter_id', $newsletters)
    ->distinct();
  $data = $query->execute()->fetchAll();

where si.status is a flag indicating whether the user is subscribed (1) or unsubscribed (0)

and $newsletters is a Array of newsletter ids to filter on

  • thanks a lot! I was primarily looking for a SQL Query but I managed to track who unsubscribed based on your answer! – Argiris A Apr 18 '16 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.