Changed how the "edited by" message appears in the posts edited by admin

This commit is contained in:
moodler
2006-04-05 02:15:10 +00:00
parent a5a9cd99b4
commit 9bdedea400
2 changed files with 53 additions and 53 deletions
-12
View File
@@ -2468,18 +2468,6 @@ function forum_update_post($post,&$message) {
$post->modified = time();
if ($USER->id != $post->userid) { // Not the original author
$data->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$USER->id.'&course='.$post->course.'">'.
fullname($USER).'</a>';
$data->date = userdate($post->modified);
$editedby = get_string('editedby', 'forum', $data);
if ($post->format == FORMAT_HTML) {
$post->message .= '<p>(<span class="edited">'.$editedby.'</span>)</p>';
} else {
$post->message .= "\n\n(".$editedby.')';
}
}
if (!$post->parent) { // Post is a discussion starter - update discussion title too
set_field("forum_discussions", "name", $post->subject, "id", $post->discussion);
}
+53 -41
View File
@@ -103,7 +103,7 @@
}
if ($realpost->userid <> $USER->id && !isadmin()){
error ("you can not update this post");
error("You can not update this post");
}
if (get_field('forum', 'type', 'id', $forum) == 'news' && !$post->parent) {
@@ -124,28 +124,29 @@
error(get_string("couldnotupdate", "forum"), $errordestination);
}
}
if (!isset($post->error)) {
if (forum_update_post($post,$message)) {
if (forum_update_post($post,$message)) {
add_to_log($course->id, "forum", "update post",
"discuss.php?d=$post->discussion&amp;parent=$post->id", "$post->id", $cm->id);
add_to_log($course->id, "forum", "update post",
"discuss.php?d=$post->discussion&amp;parent=$post->id", "$post->id", $cm->id);
$timemessage = 2;
if (!empty($message)) { // if we're printing stuff about the file upload
$timemessage = 4;
$timemessage = 2;
if (!empty($message)) { // if we're printing stuff about the file upload
$timemessage = 4;
}
$message .= '<br />'.get_string("postupdated", "forum");
if ($subscribemessage = forum_post_subscription($post)) {
$timemessage = 4;
}
redirect(forum_go_back_to("discuss.php?d=$post->discussion#$post->id"), $message.$subscribemessage, $timemessage);
} else {
error(get_string("couldnotupdate", "forum"), $errordestination);
}
$message .= '<br />'.get_string("postupdated", "forum");
if ($subscribemessage = forum_post_subscription($post)) {
$timemessage = 4;
}
redirect(forum_go_back_to("discuss.php?d=$post->discussion#$post->id"), $message.$subscribemessage, $timemessage);
} else {
error(get_string("couldnotupdate", "forum"), $errordestination);
}
exit;
exit;
}
} else if ($post->discussion) { // Adding a new post to an existing discussion
@@ -199,35 +200,34 @@
if ($newstopic && empty($post->timeenddisabled) && $discussion->timeend <= $discussion->timestart) {
$post->error = get_string('timestartenderror', 'forum');
} else {
$message = '';
if ($discussion->id = forum_add_discussion($discussion,$message)) {
$message = '';
if ($discussion->id = forum_add_discussion($discussion,$message)) {
add_to_log($course->id, "forum", "add discussion",
"discuss.php?d=$discussion->id", "$discussion->id", $cm->id);
add_to_log($course->id, "forum", "add discussion",
"discuss.php?d=$discussion->id", "$discussion->id", $cm->id);
$timemessage = 2;
if (!empty($message)) { // if we're printing stuff about the file upload
$timemessage = 4;
}
$message .= '<br />'.get_string("postadded", "forum", format_time($CFG->maxeditingtime));
$timemessage = 2;
if (!empty($message)) { // if we're printing stuff about the file upload
$timemessage = 4;
}
$message .= '<br />'.get_string("postadded", "forum", format_time($CFG->maxeditingtime));
if ($post->mailnow) {
$message .= get_string("postmailnow", "forum");
$timemessage = 4;
}
if ($post->mailnow) {
$message .= get_string("postmailnow", "forum");
$timemessage = 4;
if ($subscribemessage = forum_post_subscription($discussion)) {
$timemessage = 4;
}
redirect(forum_go_back_to("view.php?f=$post->forum"), $message.$subscribemessage, $timemessage);
} else {
error(get_string("couldnotadd", "forum"), $errordestination);
}
if ($subscribemessage = forum_post_subscription($discussion)) {
$timemessage = 4;
}
redirect(forum_go_back_to("view.php?f=$post->forum"), $message.$subscribemessage, $timemessage);
} else {
error(get_string("couldnotadd", "forum"), $errordestination);
}
exit;
exit;
}
}
}
@@ -694,6 +694,18 @@
}
echo '</center>';
if ($USER->id != $post->userid) { // Not the original author, so add a message to the end
$data->date = userdate($post->modified);
if ($post->format == FORMAT_HTML) {
$data->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$USER->id.'&course='.$post->course.'">'.
fullname($USER).'</a>';
$post->message .= '<p>(<span class="edited">'.get_string('editedby', 'forum', $data).'</span>)</p>';
} else {
$data->name = fullname($USER);
$post->message .= "\n\n(".get_string('editedby', 'forum', $data).')';
}
}
print_simple_box_start("center");
require("post.html");
print_simple_box_end();