Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Minor Newsletter Mod

Quote Reply
Minor Newsletter Mod
I don't know if this has been done by anyone else yet, but I just made some tiny changes to the Newsletter routine, it phases out the need for the subscribers table and adds some functionality to your user.cgi script. At least for 'Registered' memebers! I plan creating some new fields for the Users table so I can create blocks of 'New Links' Newsletters by Category. It has some interesting possibilities for targeting your subscribers...

Question for Alex? If no one else knows: I am wondering if the Subscribers Table is used for anything else or can I safely drop it, now that it isn't being used?

Here is the code if anyone is interested:
Code:
sub build_email_list {
# --------------------------------------------------------
# Build a list of all subscribers to mail to.
#
my ($in, $db) = @_;
my ($sth, $select, $email, $username);

my $users = new Links: BSQL $LINKS{admin_root_path} . "/defs/Users.def";

my $query = qq!
SELECT Email, Username
FROM Users
WHERE (Users.Status = 'Registered')
!;
$sth = $users->prepare ($query);
$sth->execute() or die "Can't Execute: $DBI::errstr";
$select = "<select name='mailto' MULTIPLE size=4>";
while (($email, $username) = $sth->fetchrow_array) {
$select .= "<option value=\"$email\" SELECTED>$username";
}
$select .= "</select>";

return $select;
}

[This message has been edited by phoule (edited February 28, 2000).]

[This message has been edited by phoule (edited February 28, 2000).]