Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 07-26-2002 16:27:54

Will
Member
Registered: 02-26-2003
Posts: 493
Website

Mail List...

Is there away now or in the future to have every order that is placed have the email address put in to one of the mailing lists?


Will

Offline

 

#2 07-26-2002 17:46:17

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Mail List...

We did this as a hack for someone before.  The trick is to add new email addresses to the mail list as they're read in in ./library/common/site_usr_define.pl. 

At the bottom of the routine: site_update_user_cookie_info

add the lines:

### CUT

$fd_temp_pg = "$form_data{'pg'}";

if ($form_data_user_realname ne "" && $form_data_user_email ne "" && $fd_temp_pg !~ /maillist/) {

&site_user_add_maillist;

} ######### End of if statement.

### CUT

Right before the close of the last if statement in the routine.  Then, add this routine to the bottom of the file:

### CUT

#######################################################################
# Sub Site User Add Maillist                                  #
#######################################################################

sub site_user_add_maillist {

$address_found_in_maillist = "no";
$current_maillist_ref_no = "1";

@temp_lines = "";

open (FILE, "$data_path_maillist_data$current_maillist_ref_no.$data_ext");
flock (FILE, 2);

@lines = <FILE>;

close(FILE);

foreach $line(@lines){

($subscriber_ref_no,$subscriber_name,$subscriber_email) = split(/|/,$line);

chop($subscriber_email);

push(@subscriber_ref_no,$subscriber_ref_no);

} ######### End of foreach statement.

$highest_value = $subscriber_ref_no<$#subscriber_ref_no>;
$highest_value++;
$new_subscriber_ref_no = $highest_value;

foreach $line(@lines){

($subscriber_ref_no,$subscriber_name,$subscriber_email) = split(/|/,$line);

chop($subscriber_email);

if ($user_data_email eq "$subscriber_email") {

$address_found_in_maillist = "yes";

} else {

$temp_line = "$subscriber_ref_no|$subscriber_name|$subscriber_email";

push(@temp_lines,$temp_line);

} ######### End of if statement.

} ######### End of foreach statement.

if ($address_found_in_maillist eq "no") {

$temp_line = "$new_subscriber_ref_no|$user_data_realname|$user_data_email";

push(@temp_lines,$temp_line);

open (FILE, ">$data_path_maillist_data$current_maillist_ref_no.$data_ext");
flock (FILE, 2);

foreach $line(@temp_lines){

($subscriber_ref_no,$subscriber_name,$subscriber_email) = split(/|/,$line);

if ($line ne "" && $subscriber_ref_no ne ""){

print (FILE "$linen");

} ######### End of if statement.

} ######### End of foreach statement.

close(FILE);

@temp_lines = "";

open (FILE, "$maillist_db_file");
flock (FILE, 2);

@lines = <FILE>;

close(FILE);

foreach $line(@lines){

($maillist_ref_no,$maillist_name,$maillist_active,$maillist_subscriber_no,$maillist_description) = split(/|/,$line);

chop($maillist_description);

if ($current_maillist_ref_no eq "$maillist_ref_no") {

$maillist_subscriber_no++;

$temp_line = "$maillist_ref_no|$maillist_name|$maillist_active|$maillist_subscriber_no|$maillist_description";

push(@temp_lines,$temp_line);

} else {

$temp_line = "$maillist_ref_no|$maillist_name|$maillist_active|$maillist_subscriber_no|$maillist_description";

push(@temp_lines,$temp_line);

} ######### End of if statement.

} ######### End of foreach statement.

open (FILE, ">$maillist_db_file");
flock (FILE, 2);

foreach $line(@temp_lines){

($maillist_ref_no,$maillist_name,$maillist_active,$maillist_subscriber_no,$maillist_description) = split(/|/,$line);

if ($line ne "" && $maillist_ref_no ne ""){

print (FILE "$linen");

} ######### End of if statement.

} ######### End of foreach statement.

close(FILE);

} ######### End of if statement.

}

### CUT

That will add the user to the main (#1) maillist if they don't already subscribe to it.  It works any time cookie info is updated and the email address and real name aren't blank.  Hope that helps.

PS. In CCP5, this code would be in the ./library/modules/ste_usr.pl file and would consist of about 15 lines of code (including two SQL statements - one to figure out if the user is subscribed and the other to add them if they aren't subscribed). 


Nick Hendler

Offline

 

#3 07-27-2002 08:16:20

Will
Member
Registered: 02-26-2003
Posts: 493
Website

Re: Mail List...

Appreciate the modification... However At this point I will not put it in CCP4... I'll be looking to do this to CCP5... Actually I was hoping it would of been a simple option in ccp5. 

Will


Will

Offline

 

#4 07-29-2002 07:29:35

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Mail List...

We'll be opening up a CCP5 forum upon release.  Post a request there and we'll post the mod.


Nick Hendler

Offline

 

Board footer