Skip to content

Commit

Permalink
Sending Emails to User from Profile Page now checks for User Status
Browse files Browse the repository at this point in the history
Update for #757
  • Loading branch information
eSilverStrike committed Dec 21, 2017
1 parent 235ce6e commit 9a6c60d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
3 changes: 2 additions & 1 deletion language/english.php
Expand Up @@ -525,7 +525,8 @@
40 => " seconds ago. This site requires at least {$_CONF['speedlimit']} seconds between sending messages",
41 => "This user doesn't exist.",
42 => "This users email address doesn't exist. This most likely means is is an OAuth user account.",
43 => 'This users email address is invalid.'
43 => 'This users email address is invalid.',
44 => 'This users status is set to something other than Active or New Password therefore the email address is assumed bad.'
);

###############################################################################
Expand Down
3 changes: 2 additions & 1 deletion language/english_utf-8.php
Expand Up @@ -525,7 +525,8 @@
40 => " seconds ago. This site requires at least {$_CONF['speedlimit']} seconds between sending messages",
41 => "This user doesn't exist.",
42 => "This users email address doesn't exist. This most likely means is is an OAuth user account.",
43 => 'This users email address is invalid.'
43 => 'This users email address is invalid.',
44 => 'This users status is set to something other than Active or New Password therefore the email address is assumed bad.'
);

###############################################################################
Expand Down
3 changes: 2 additions & 1 deletion language/japanese_utf-8.php
Expand Up @@ -533,7 +533,8 @@
40 => " 秒前に送信しています。少なくとも{$_CONF['speedlimit']}秒待って、次のメッセージを送信してください。",
41 => 'このユーザーは存在しません。',
42 => 'このユーザーのメールアドレスは存在しません。おそらくOAuthユーザーのアカウントでしょう。',
43 => 'このユーザーのメールアドレスは無効です。'
43 => 'このユーザーのメールアドレスは無効です。',
44 => 'This users status is set to something other than Active or New Password therefore the email address is assumed bad.'
);

###############################################################################
Expand Down
17 changes: 11 additions & 6 deletions public_html/profiles.php
Expand Up @@ -190,19 +190,24 @@ function contactform($uid, $cc = false, $subject = '', $message = '')
$continue = false;
$msg_no_mail = $LANG08[35];

$result = DB_query("SELECT email FROM {$_TABLES['users']} WHERE uid = '$uid'");
$result = DB_query("SELECT email, status FROM {$_TABLES['users']} WHERE uid = '$uid'");
$nrows = DB_numRows($result);

if ($nrows == 1) {
$P = DB_fetchArray($result);
if (!empty($P['email'])) {
if (COM_isEMail($P['email'])) {
$continue = true;

if ($P['status'] == USER_ACCOUNT_ACTIVE || $P['status'] == USER_ACCOUNT_NEW_PASSWORD) {
if (!empty($P['email'])) {
if (COM_isEMail($P['email'])) {
$continue = true;
} elseif ($isAdmin) {
$msg_no_mail = $LANG08[43]; // Email invalid
}
} elseif ($isAdmin) {
$msg_no_mail = $LANG08[43]; // Email invalid
$msg_no_mail = $LANG08[42]; // Email doesn't exist
}
} elseif ($isAdmin) {
$msg_no_mail = $LANG08[42]; // Email doesn't exist
$msg_no_mail = $LANG08[44]; // User Status issues, assume bad email
}
} elseif ($isAdmin) {
$msg_no_mail = $LANG08[41]; // User doesn't exist
Expand Down
2 changes: 1 addition & 1 deletion system/lib-user.php
Expand Up @@ -999,7 +999,7 @@ function USER_showProfile($uid, $preview = false, $msg = 0, $plugin = '')
$user_templates->set_var('user_id', $uid);
$user_templates->set_var('uid', $uid);

if (!empty($A['email']) && USER_isCanSendMail($uid)) {
if (!empty($A['email']) && USER_isCanSendMail($uid) && ($A['status'] == USER_ACCOUNT_ACTIVE || $A['status'] == USER_ACCOUNT_NEW_PASSWORD)) {
$user_templates->set_var('lang_sendemail', $LANG04[81]);
$user_templates->set_var('email_option', true);
} else {
Expand Down

0 comments on commit 9a6c60d

Please sign in to comment.