I made a change to Admin.pm- a change I think is a good one. Becuase I just did a large mailing, I got a few dead ones returned. Rather than inactivate them in Comm and then turn the mailer off in Links, I modified Admin.pm to that by making a user inactive, it will turn the mailer off in Links at the same time, as well as deactivate the account.
As I thought more, I thought it would also be nice to do the reverse, too... then I activate someone in Comm, it should activate them in Links, too. So, I wrote some code. Got MOST of it working, but it is not reading "com_enabled" right. I wanted if "com_enabled" = 0, do all the deactivate stuff... if = 1, do all the activate stuff.... but for some reason, "com_enabled" is always = 1, even when I deavtivate an account.
Any ideas? Am I using the wrong vaiable (and what is the right one?)
Here is the code I used...
my $new_com = $user->{'com_enabled'};
if ($new_com = 0 ) {
require lib;
lib->import('/path/to/Links/admin');
my $other_db = new GT::SQL '/path/to/Links/admin/defs';
my $user_db = $other_db->table ('Users');
$user->{app_Forum} = '1';
$user->{app_Links} = '1';
$user->{prof_rm} = 'No';
$user_db->update ( {
ReceiveMail => 'No',
Newsletter => 'No',
Status => 'Closed'
}, { Username => $user->{comm_username} }) or die "Can't Update: $GT::SQL::error";
}
if ($new_com = 1 ) {
require lib;
lib->import('/path/to/Links/admin');
my $other_db = new GT::SQL '/path/to/Links/admin/defs';
my $user_db = $other_db->table ('Users');
$user->{app_Forum} = '2';
$user->{app_BCDB} = '2';
$user->{prof_rm} = 'Yes';
$user->{prof_website} = $new_com;
$user_db->update ( {
ReceiveMail => $user->{prof_rm},
Newsletter => $user->{prof_rm},
Status => 'Registered',
Website => $user->{prof_website},
Occupation => $user->{prof_occupation},
Country => $user->{prof_country},
Location => $user->{prof_location}
}, { Username => $user->{comm_username} }) or die "Can't Update: $GT::SQL::error";
}
As an aside, Comm NOT doing this is one of my biggest criticisms of it Alex. I mean Comm works fine and all, but I really think/expect that as a central repository, changes in Comm should refect in the individual programs. I realize I have some unique fields (Location, Country, etc), but I think something like deactivating a user in Comm should automatically deactive them in Liks and/or Forum, and take them OFF the mailing lists...
My two cent Alex- nothing more!
dave
Big Cartoon DataBase
Big Comic Book DataBase
As I thought more, I thought it would also be nice to do the reverse, too... then I activate someone in Comm, it should activate them in Links, too. So, I wrote some code. Got MOST of it working, but it is not reading "com_enabled" right. I wanted if "com_enabled" = 0, do all the deactivate stuff... if = 1, do all the activate stuff.... but for some reason, "com_enabled" is always = 1, even when I deavtivate an account.
Any ideas? Am I using the wrong vaiable (and what is the right one?)
Here is the code I used...
my $new_com = $user->{'com_enabled'};
if ($new_com = 0 ) {
require lib;
lib->import('/path/to/Links/admin');
my $other_db = new GT::SQL '/path/to/Links/admin/defs';
my $user_db = $other_db->table ('Users');
$user->{app_Forum} = '1';
$user->{app_Links} = '1';
$user->{prof_rm} = 'No';
$user_db->update ( {
ReceiveMail => 'No',
Newsletter => 'No',
Status => 'Closed'
}, { Username => $user->{comm_username} }) or die "Can't Update: $GT::SQL::error";
}
if ($new_com = 1 ) {
require lib;
lib->import('/path/to/Links/admin');
my $other_db = new GT::SQL '/path/to/Links/admin/defs';
my $user_db = $other_db->table ('Users');
$user->{app_Forum} = '2';
$user->{app_BCDB} = '2';
$user->{prof_rm} = 'Yes';
$user->{prof_website} = $new_com;
$user_db->update ( {
ReceiveMail => $user->{prof_rm},
Newsletter => $user->{prof_rm},
Status => 'Registered',
Website => $user->{prof_website},
Occupation => $user->{prof_occupation},
Country => $user->{prof_country},
Location => $user->{prof_location}
}, { Username => $user->{comm_username} }) or die "Can't Update: $GT::SQL::error";
}
As an aside, Comm NOT doing this is one of my biggest criticisms of it Alex. I mean Comm works fine and all, but I really think/expect that as a central repository, changes in Comm should refect in the individual programs. I realize I have some unique fields (Location, Country, etc), but I think something like deactivating a user in Comm should automatically deactive them in Liks and/or Forum, and take them OFF the mailing lists...
My two cent Alex- nothing more!
dave
Big Cartoon DataBase
Big Comic Book DataBase