1. RippCo

    RippCo - Feb 4, 2015 New Member VIP Member

    Credit
    Point
    here's a little perl script that will set your existing mailing list users as being subscribed in the database.
    IT REQUIRES: a text file with the e-mail addresses of your list subscribers, 1 per line. You can get the export file from mailchimp, and then use whatever utility to get a file with just the e-mail address.

    modify the database information to suit

    NO support given, I just wanted to throw this out there, I whipped it up in a few minutes and got the job done. You're on your own :rolleyes:

    Code:
    #!/usr/bin/perl
    
    use DBI;
    # MySQL database configurations
    my $dsn = "DBI:mysql:YOURDATABASE";
    my $username = "YOURDATABASEUSER";
    my $password = 'YOURDATABASEPASS';
    
    my $dbh = DBI->connect($dsn,$username,$password, \%attr);
    foreach $E ( <STDIN> ) {
        chomp( $E );
    
        $sql = "UPDATE xf_user SET brmi_subscribe = 1 WHERE email = '$E'";
        print "$sql\n";
    
        $sth = $dbh->prepare($sql);
        $sth->execute();
        $sth->finish();
    }
    
    $dbh->disconnect();
    exit;
    
     
    Loading...
  2. RippCo

    RippCo - Feb 4, 2015 New Member VIP Member

    Credit
    Point
    whoops

    then to use it you just set it executable (chmod u+x script.pl)
    and run it like so

    Code:
    ./script.pl < emails.txt
    or

    Code:
    perl script.pl < emails.txt
     
    #2
  3. RippCo

    RippCo - Feb 4, 2015 New Member VIP Member

    Credit
    Point
    Question, though, for the Brivium crew....

    If someone unsubscribes via the link on an e-mail, is there any mechanism in place to account for this, and make the change in the database? Through a cron job or?
     
    #3
  4. Brivium

    Brivium - Feb 4, 2015 XenForo Services Staff Member

    Credit
    Point
    Dear RippCo,

    Thanks for your sharing. About your question, i'd like to confirm with you that If someone unsubscribes via the link on an email, it won't update in the XenForo database.

    Regards,
     
    #4