Uhm.. you may have a bug in the MLM... It turns out that the unsubscribed users are for some reason being added to the "All" unsubscribed list instead of to the specific one I was using. In any case, when MaxBulk checks with MLM for a list of unsubscribed users, it only checks the specific list, it doesn't check the "All" list. This is, I believe, incorrect, as if a users unsubscribes to All lists, MaxBulk should be aware of that and remove the users from the local lists.
To fix this, I modified the code for the function GetLocalUnsubscribeList in lm_functions.php as follow, adding the code that appends results for the "All" lists so that those unusbscirbed users are considered as well:
$singlelist = explode( ";", $lists );
foreach ( $singlelist as $mylist ) {
$filename = $path_to_offlists . "/" . $mylist . $ext_list;
$lockfile = $path_to_offlists . "/" . $mylist . $ext_list_lock;
$locker = @fopen( $lockfile, "a+" );
If ( $locker && file_exists( $filename ) ) {
If ( flock( $locker, LOCK_EX ) ) {
//$result .= LoadFileContentsAsText( $filename );
$fcontents = LoadFileContentsAsArray( $filename );
if ( count($fcontents) > 0 ) {
while ( list ($line_num, $line) = each ($fcontents) ) { // while there are elements in the array
$line = str_replace("\n", "", $line);
$field = explode( "\t", $line );
if ( $field[5] == 0 ) {
//if ($result <> "" ) { $result .= "\n"; }
$result .= $line . "\n";
}
}
}
EmptyFile( $filename );
flock( $locker, LOCK_UN );
} else {
$mlm_err = "Error opening $lockfile";
$result = False;
}
@fclose( $locker );
} else {
$mlm_err = "Error opening $filename";
$result = False;
}
}
$singlelist = explode( ";", "All" );
foreach ( $singlelist as $mylist ) {
$filename = $path_to_offlists . "/" . $mylist . $ext_list;
$lockfile = $path_to_offlists . "/" . $mylist . $ext_list_lock;
$locker = @fopen( $lockfile, "a+" );
If ( $locker && file_exists( $filename ) ) {
If ( flock( $locker, LOCK_EX ) ) {
//$result .= LoadFileContentsAsText( $filename );
$fcontents = LoadFileContentsAsArray( $filename );
if ( count($fcontents) > 0 ) {
while ( list ($line_num, $line) = each ($fcontents) ) { // while there are elements in the array
$line = str_replace("\n", "", $line);
$field = explode( "\t", $line );
if ( $field[5] == 0 ) {
//if ($result <> "" ) { $result .= "\n"; }
$result .= $line . "\n";
}
}
}
EmptyFile( $filename );
flock( $locker, LOCK_UN );
} else {
$mlm_err = "Error opening $lockfile";
$result = False;
}
@fclose( $locker );
} else {
$mlm_err = "Error opening $filename";
$result = False;
}
}
To fix this, I modified the code for the function GetLocalUnsubscribeList in lm_functions.php as follow, adding the code that appends results for the "All" lists so that those unusbscirbed users are considered as well:
$singlelist = explode( ";", $lists );
foreach ( $singlelist as $mylist ) {
$filename = $path_to_offlists . "/" . $mylist . $ext_list;
$lockfile = $path_to_offlists . "/" . $mylist . $ext_list_lock;
$locker = @fopen( $lockfile, "a+" );
If ( $locker && file_exists( $filename ) ) {
If ( flock( $locker, LOCK_EX ) ) {
//$result .= LoadFileContentsAsText( $filename );
$fcontents = LoadFileContentsAsArray( $filename );
if ( count($fcontents) > 0 ) {
while ( list ($line_num, $line) = each ($fcontents) ) { // while there are elements in the array
$line = str_replace("\n", "", $line);
$field = explode( "\t", $line );
if ( $field[5] == 0 ) {
//if ($result <> "" ) { $result .= "\n"; }
$result .= $line . "\n";
}
}
}
EmptyFile( $filename );
flock( $locker, LOCK_UN );
} else {
$mlm_err = "Error opening $lockfile";
$result = False;
}
@fclose( $locker );
} else {
$mlm_err = "Error opening $filename";
$result = False;
}
}
$singlelist = explode( ";", "All" );
foreach ( $singlelist as $mylist ) {
$filename = $path_to_offlists . "/" . $mylist . $ext_list;
$lockfile = $path_to_offlists . "/" . $mylist . $ext_list_lock;
$locker = @fopen( $lockfile, "a+" );
If ( $locker && file_exists( $filename ) ) {
If ( flock( $locker, LOCK_EX ) ) {
//$result .= LoadFileContentsAsText( $filename );
$fcontents = LoadFileContentsAsArray( $filename );
if ( count($fcontents) > 0 ) {
while ( list ($line_num, $line) = each ($fcontents) ) { // while there are elements in the array
$line = str_replace("\n", "", $line);
$field = explode( "\t", $line );
if ( $field[5] == 0 ) {
//if ($result <> "" ) { $result .= "\n"; }
$result .= $line . "\n";
}
}
}
EmptyFile( $filename );
flock( $locker, LOCK_UN );
} else {
$mlm_err = "Error opening $lockfile";
$result = False;
}
@fclose( $locker );
} else {
$mlm_err = "Error opening $filename";
$result = False;
}
}