Using separate subscriptions isn't working for me so I changed to the global newsletter option. How would I go about moving all the people that had subscribed to the individual categories to the top level/global category?
Oct 5, 2006, 11:00 PM
Staff (4101 posts)
Oct 5, 2006, 11:00 PM
Post #3 of 4
Views: 2345
Here's a quick script that should do it:
use strict;
use lib '/path/to/admin';
use Links qw/$DB/;
Links::init('/path/to/admin');
my $ns = $DB->table('NewsletterSubscription');
my @users = $ns->select('DISTINCT(UserID)')->fetchall_list;
$ns->delete_all();
$ns->insert_multiple(['UserID', 'CategoryID'], map {[$_, 0]} @users);
Adrian
Code:
#!/usr/bin/perl -w use strict;
use lib '/path/to/admin';
use Links qw/$DB/;
Links::init('/path/to/admin');
my $ns = $DB->table('NewsletterSubscription');
my @users = $ns->select('DISTINCT(UserID)')->fetchall_list;
$ns->delete_all();
$ns->insert_multiple(['UserID', 'CategoryID'], map {[$_, 0]} @users);
Adrian