From 69912085b9dc5ee186fdcc8228215d9ac7ea2330 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 6 Aug 2011 07:11:17 +0000 Subject: [PATCH] - web: send user a private message when - one of their posts is moderated - a banishment vote starts or completes. This is needed in cases where the user can't or doesn't read email to their account's address. The "from" address of the PM is that of the user, not the moderator. svn path=/trunk/boinc/; revision=23941 --- checkin_notes | 16 +++++++++++++++ html/inc/forum_email.inc | 23 ++++++++++++---------- html/inc/pm.inc | 7 +++---- html/user/pm.php | 2 +- html/user/team_founder_transfer_action.php | 2 +- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/checkin_notes b/checkin_notes index 58eda8815f..735591b1db 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4643,3 +4643,19 @@ David 4 Aug 2011 sched/ sched_customize.cpp + +David 6 Aug 2011 + - web: send user a private message when + - one of their posts is moderated + - a banishment vote starts or completes. + This is needed in cases where the user can't or doesn't + read email to their account's address. + The "from" address of the PM is that of the user, not the moderator. + + html/ + inc/ + pm.inc + forum_email.inc + user/ + pm.php + team_founder_transfer_action.php diff --git a/html/inc/forum_email.inc b/html/inc/forum_email.inc index 0dd207510f..47e0534fa1 100644 --- a/html/inc/forum_email.inc +++ b/html/inc/forum_email.inc @@ -76,9 +76,10 @@ $explanation The content of your post: $post->content -For further information and assistance with ".PROJECT." go to ".MASTER_URL; +For assistance with ".PROJECT." go to ".MASTER_URL; $success = send_email($user, $subject, $body); + pm_send($user, $user, $subject, $body, false); $body = "Because of moderation by $moderator->name (ID $moderator->id), The following email was sent to $user->name (ID $user->id) @@ -105,15 +106,15 @@ function send_thread_moderation_email( $subject = PROJECT." forum moderation notice"; $body = "Your thread '$thread->title' ".URL_BASE."forum_thread.php?id=$thread->id -has been $action_name -by moderator $moderator->name (ID $moderator->id). +has been $action_name by moderator $moderator->name (ID $moderator->id). $explanation -For further information and assistance with ".PROJECT." go to ".MASTER_URL; +For assistance with ".PROJECT." go to ".MASTER_URL; $subject = "THREAD $action REPORT: $thread->title"; $success = mail_report_list($forum, $subject, $body); $success &= send_email($user, $subject, $body); + pm_send($user, $user, $subject, $body, false); return $success; } @@ -156,7 +157,7 @@ $message Contents of the post: $post->content -For further information and assistance with ".PROJECT." go to ".MASTER_URL; +For assistance with ".PROJECT." go to ".MASTER_URL; $success = mail_report_list($forum, $subject, $body, true); @@ -175,8 +176,8 @@ For further information and assistance with ".PROJECT." go to ".MASTER_URL; function send_banish_email($forum, $user, $duration, $reason) { $subject = PROJECT." posting privileges suspended"; $body = " -This email is to inform you that you will not be able to -post to the ".PROJECT." message boards until ".date('M j, Y G:i', $duration).", +You will not be able to post to the ".PROJECT." message boards +until ".date('M j, Y G:i', $duration).", because your postings have not followed our guidelines. "; if ($reason) { @@ -185,6 +186,7 @@ because your postings have not followed our guidelines. } $success = mail_report_list($forum, $user->name." has been banished.", $body); $success &= send_email($user, $subject, $body); + pm_send($user, $user, $subject, $body, false); return $success; } @@ -195,12 +197,12 @@ function send_banish_vote_email($user, $duration, $reason, $end_time) { $subject = PROJECT." banishment vote underway"; $vote_url=parse_config(get_config(), "")."forum_banishment_vote.php"; $body = " -This email if to inform you that a vote has been started -regarding your banishment from the ".PROJECT." message boards until ".date('M j, +A vote has been started to banish you +from the ".PROJECT." message boards until ".date('M j, Y G:i', $duration+$now).", because your postings have not followed our guidelines. -This vote will be underway until ".date('M j, Y G:i',$end_time)." or until a majority +This vote will last until ".date('M j, Y G:i',$end_time)." or until a majority decision has been reached. If the vote does not result in banishment, you will be able to resume posting at that time. "; @@ -209,6 +211,7 @@ able to resume posting at that time. $body .= $reason; } $success = send_email($user, $subject, $body); + pm_send($user, $user, $subject, $body, false); $body .= "\n\nid diff --git a/html/inc/pm.inc b/html/inc/pm.inc index c8c9902e45..c699a2d306 100644 --- a/html/inc/pm.inc +++ b/html/inc/pm.inc @@ -127,11 +127,10 @@ function pm_web_line($notify) { return "".tra("Private message%1 from %2, subject:" , "", $from_user->name )." $pm->subject"; } -function pm_send($to_user, $subject, $content, $send_email) { - global $g_logged_in_user; +function pm_send($from_user, $to_user, $subject, $content, $send_email) { $sql_subject = boinc_real_escape_string(strip_tags($subject)); $sql_content = boinc_real_escape_string($content); - $mid = BoincPrivateMessage::insert("(userid, senderid, date, subject, content) VALUES ($to_user->id, $g_logged_in_user->id, UNIX_TIMESTAMP(), '$sql_subject', '$sql_content')"); + $mid = BoincPrivateMessage::insert("(userid, senderid, date, subject, content) VALUES ($to_user->id, $from_user->id, UNIX_TIMESTAMP(), '$sql_subject', '$sql_content')"); if (!$mid) { error_page(tra("Couldn't create message")); } @@ -145,7 +144,7 @@ function pm_send($to_user, $subject, $content, $send_email) { break; case 1: send_pm_notification_email( - $g_logged_in_user, $to_user, $subject, $content + $from_user, $to_user, $subject, $content ); break; } diff --git a/html/user/pm.php b/html/user/pm.php index 765d5e5051..4b7b5d1d0f 100644 --- a/html/user/pm.php +++ b/html/user/pm.php @@ -226,7 +226,7 @@ function do_send($logged_in_user) { if (!is_moderator($logged_in_user, null)) { check_pm_count($logged_in_user->id); } - pm_send($user, $subject, $content, true); + pm_send($logged_in_user, $user, $subject, $content, true); } Header("Location: pm.php?action=inbox&sent=1"); diff --git a/html/user/team_founder_transfer_action.php b/html/user/team_founder_transfer_action.php index 97de17bcd8..4feb56cae9 100644 --- a/html/user/team_founder_transfer_action.php +++ b/html/user/team_founder_transfer_action.php @@ -50,7 +50,7 @@ If you do not respond within 60 days, ".$user->name." will be allowed to become the team founder. "; - pm_send($founder, $subject, $body, false); + pm_send($user, $founder, $subject, $body, false); $subject = PROJECT." team founder transfer"; $body = "Team member ".$user->name." has asked that you