]> git.mjollnir.org Git - moodle.git/commitdiff
Changed how the "edited by" message appears in the posts edited by admin
authormoodler <moodler>
Wed, 5 Apr 2006 02:15:10 +0000 (02:15 +0000)
committermoodler <moodler>
Wed, 5 Apr 2006 02:15:10 +0000 (02:15 +0000)
mod/forum/lib.php
mod/forum/post.php

index a578445438159746dbc189abeaab03d994783ad9..96ef8c57a5834e79f3209ed9be81daa65a74efee 100644 (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);
     }
index 39249e6f426dd4ef19bc4de84821f16c779a892a..b2bd7091db3355ec42f5777cb1115c4e8521b063 100644 (file)
             }
 
             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) {
                     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;
-                }
-                $message .= '<br />'.get_string("postupdated", "forum");
+                    $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);
+                    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;
+                } else {
+                    error(get_string("couldnotupdate", "forum"), $errordestination);
+                }
+                exit;
 
             }
         } else if ($post->discussion) { // Adding a new post to an existing discussion
             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;
-                }
+                    if ($subscribemessage = forum_post_subscription($discussion)) {
+                        $timemessage = 4;
+                    }
 
-                redirect(forum_go_back_to("view.php?f=$post->forum"), $message.$subscribemessage, $timemessage);
+                    redirect(forum_go_back_to("view.php?f=$post->forum"), $message.$subscribemessage, $timemessage);
 
-            } else {
-                error(get_string("couldnotadd", "forum"), $errordestination);
-            }
+                } else {
+                    error(get_string("couldnotadd", "forum"), $errordestination);
+                }
 
-            exit;
+                exit;
             }
         }
     }
     }
     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();