coder1.com

  • home
  • drupal articles
  • contact
Home

Subscribe

Subscribe All Users to a Simplenews Newsletter

Mike Milano — April 29, 2009 - 10:51am

There's been a couple times where I've had to subscribe all users to a new newsletter.

I started out with a snippet I found which cleans up the subscriptions, but I lost the link or I would have referenced it here.

Here's the code that will subscribe all users to newsletter node id 16. Note I'm using mysql_insert_id() as a quick fix so you will need to use another method if you're not using mysql.

  1. $result = db_query("SELECT uid, mail FROM {users} WHERE uid>0");
  2.  
  3. while ($row = db_fetch_object($result)) {

  • Drupal
  • Newsletter
  • Simplenews
  • Subscribe
  • Add new comment
  • Read more
Syndicate content

Poll

Have you used any NoSQL Databases?:

User login

  • Request new password

Navigation

  • Recent posts

  • home
  • drupal articles
  • contact