Gossamer Forum
Home : Products : Gossamer Links : Discussions :

convert all to global newsletter

Quote Reply
convert all to global newsletter
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?
Quote Reply
Re: [fantasyman] convert all to global newsletter In reply to
Any thoughts?
Quote Reply
Re: [fantasyman] convert all to global newsletter In reply to
Here's a quick script that should do it:

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
Post deleted by Matthias70 In reply to