radman16
Wed 14 November 2007, 04:52 am GMT +0100
I have manual activation turned on because I only want registered users from certain domains. But if I block or don't activate someone they still get an email saying they have been activated. When they go to the login form they are then told there isn't an active user by their name.
I have made the following change to the send_confirmation method which sends a more meaningful message. I'm sure there is a better way but this has been working for me. See the switch statement. Or is there a better way of doing this?
function send_confirmation($id) {
$sql = sprintf("SELECT real_name, email, active FROM %s WHERE id = %d", $this->table_name, $id);
$res = mysql_query($sql);
$user_email = mysql_result($res, 0, "email");
$this->user_full_name = mysql_result($res, 0, "real_name");
$user_active = mysql_result($res, 0, "active");
if ($this->user_full_name == "") $this->user_full_name = "User"; // change "User" to whatever you want, it's just a default name
switch ($user_active) {
case "y" :
if ($this->send_mail($user_email, 37, 24, $this->send_copy)) {
return true;
} else {
return false;
}
break;
case "n" or "b" :
if ($this->send_mail($user_email, 22, 19, $this->send_copy)) {
return true;
} else {
return false;
}
break;
}
}
I have made the following change to the send_confirmation method which sends a more meaningful message. I'm sure there is a better way but this has been working for me. See the switch statement. Or is there a better way of doing this?
function send_confirmation($id) {
$sql = sprintf("SELECT real_name, email, active FROM %s WHERE id = %d", $this->table_name, $id);
$res = mysql_query($sql);
$user_email = mysql_result($res, 0, "email");
$this->user_full_name = mysql_result($res, 0, "real_name");
$user_active = mysql_result($res, 0, "active");
if ($this->user_full_name == "") $this->user_full_name = "User"; // change "User" to whatever you want, it's just a default name
switch ($user_active) {
case "y" :
if ($this->send_mail($user_email, 37, 24, $this->send_copy)) {
return true;
} else {
return false;
}
break;
case "n" or "b" :
if ($this->send_mail($user_email, 22, 19, $this->send_copy)) {
return true;
} else {
return false;
}
break;
}
}