|
@@ -660,20 +660,26 @@ function materio_user_get_role_by_name($name) {
|
|
|
*/
|
|
|
function materio_user_mandrill_mailsend_result($result) {
|
|
|
if ( in_array($result['status'], array('rejected', 'invalid', 'error')) ) {
|
|
|
+ $email = $result['email'];
|
|
|
+
|
|
|
// remove email from pool
|
|
|
module_load_include('inc', 'simplenews', 'includes/simplenews.mail');
|
|
|
- simplenews_delete_spool(array('mail'=>$result['email']));
|
|
|
+ simplenews_delete_spool(array('mail'=>$email));
|
|
|
+ watchdog("materio_user", "@mail rejected by mandrill, removed from simplenews spool", array("@mail"=>$email));
|
|
|
|
|
|
if ( in_array($result['status'], array('invalid')) ) {
|
|
|
// unsubscribe user if mail does not exists
|
|
|
- $subscriber = simplenews_subscriber_load_by_mail($result['email']);
|
|
|
+ $subscriber = simplenews_subscriber_load_by_mail($email);
|
|
|
if ($subscriber) {
|
|
|
simplenews_subscriber_delete($subscriber);
|
|
|
}
|
|
|
// disable user
|
|
|
- $user = user_load_by_mail($result['email']);
|
|
|
- $user->status = 0;
|
|
|
- user_save($user->uid);
|
|
|
+ $user = user_load_by_mail($email);
|
|
|
+ // $user->status = 0;
|
|
|
+ user_save($user, array('status'=>0));
|
|
|
+
|
|
|
+ watchdog("materio_user", "@mail rejected as invalid by mandrill, removed from simplenews subscribers liste and user blocked", array("@mail"=>$email), WATCHDOG_WARNING, "/user/".$user->uid."/edit");
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|