I initially set the user default for 2 content types. I'd like to now add a 3rd content type, and update the subscriptions settings for all existing users to now include this 3rd content type. Is this possible to do automatically (without having to edit the subscriptions settings for each individual user)?

Comments

salvis’s picture

Status: Active » Closed (duplicate)
somebodysysop’s picture

Yes, this is a duplicate. However, I'd like to report for anyone searching to perform this particular function, the code below works:

$result = db_query("SELECT * FROM {subscriptions} WHERE module = 'node' AND field = 'type' AND value = 'story' AND recipient_uid != -2");

while ($subscription = db_fetch_object($result)) {
    db_query("INSERT INTO {subscriptions} (module, field, value, recipient_uid, send_interval, author_uid, send_updates, send_comments)
                  VALUES ('node', 'type', 'page', %d, 86400, -1, 1, 1)", $subscription->recipient_uid);
}

This will add the content type 'page' to all users who are currently subscribed to content type 'story'.

Thanks for the help!