- 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
This commit is contained in:
David Anderson 2011-08-06 07:11:17 +00:00
parent 533b4b88e1
commit 69912085b9
5 changed files with 34 additions and 16 deletions

View File

@ -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

View File

@ -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(), "<master_url>")."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\n<a href=".$vote_url."?action=yes&userid="
.$user->id

View File

@ -127,11 +127,10 @@ function pm_web_line($notify) {
return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $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;
}

View File

@ -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");

View File

@ -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