mirror of
https://github.com/moodle/moodle.git
synced 2025-02-22 19:06:51 +01:00
MDL-55632 mod_forum: Tidy up forum post messages
This commit is contained in:
parent
3ca3cc77a2
commit
2e48384dea
@ -4354,16 +4354,13 @@ function forum_add_attachment($post, $forum, $cm, $mform=null, $unused=null) {
|
||||
/**
|
||||
* Add a new post in an existing discussion.
|
||||
*
|
||||
* @global object
|
||||
* @global object
|
||||
* @global object
|
||||
* @param object $post
|
||||
* @param mixed $mform
|
||||
* @param string $unused formerly $message, renamed in 2.8 as it was unused.
|
||||
* @param stdClass $post The post data
|
||||
* @param mixed $mform The submitted form
|
||||
* @param string $unused
|
||||
* @return int
|
||||
*/
|
||||
function forum_add_new_post($post, $mform, $unused = null) {
|
||||
global $USER, $CFG, $DB;
|
||||
global $USER, $DB;
|
||||
|
||||
$discussion = $DB->get_record('forum_discussions', array('id' => $post->discussion));
|
||||
$forum = $DB->get_record('forum', array('id' => $discussion->forum));
|
||||
@ -4402,18 +4399,15 @@ function forum_add_new_post($post, $mform, $unused = null) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a post
|
||||
* Update a post.
|
||||
*
|
||||
* @global object
|
||||
* @global object
|
||||
* @global object
|
||||
* @param object $post
|
||||
* @param mixed $mform
|
||||
* @param string $message
|
||||
* @return bool
|
||||
* @param stdClass $post The post to update
|
||||
* @param mixed $mform The submitted form
|
||||
* @param string $unused
|
||||
* @return bool
|
||||
*/
|
||||
function forum_update_post($post, $mform, &$message) {
|
||||
global $USER, $CFG, $DB;
|
||||
function forum_update_post($post, $mform, $unused = null) {
|
||||
global $DB;
|
||||
|
||||
$discussion = $DB->get_record('forum_discussions', array('id' => $post->discussion));
|
||||
$forum = $DB->get_record('forum', array('id' => $discussion->forum));
|
||||
@ -4442,7 +4436,7 @@ function forum_update_post($post, $mform, &$message) {
|
||||
|
||||
$DB->update_record('forum_discussions', $discussion);
|
||||
|
||||
forum_add_attachment($post, $forum, $cm, $mform, $message);
|
||||
forum_add_attachment($post, $forum, $cm, $mform);
|
||||
|
||||
if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) {
|
||||
forum_tp_mark_post_read($post->userid, $post, $post->forum);
|
||||
|
@ -729,7 +729,7 @@ if ($mform_post->is_cancelled()) {
|
||||
}
|
||||
$updatepost = $fromform; //realpost
|
||||
$updatepost->forum = $forum->id;
|
||||
if (!forum_update_post($updatepost, $mform_post, $message)) {
|
||||
if (!forum_update_post($updatepost, $mform_post)) {
|
||||
print_error("couldnotupdate", "forum", $errordestination);
|
||||
}
|
||||
|
||||
@ -741,10 +741,10 @@ if ($mform_post->is_cancelled()) {
|
||||
}
|
||||
|
||||
if ($realpost->userid == $USER->id) {
|
||||
$message .= '<br />'.get_string("postupdated", "forum");
|
||||
$message .= get_string("postupdated", "forum");
|
||||
} else {
|
||||
$realuser = $DB->get_record('user', array('id' => $realpost->userid));
|
||||
$message .= '<br />'.get_string("editedpostupdated", "forum", fullname($realuser));
|
||||
$message .= get_string("editedpostupdated", "forum", fullname($realuser));
|
||||
}
|
||||
|
||||
$subscribemessage = forum_post_subscription($fromform, $forum, $discussion);
|
||||
@ -790,7 +790,7 @@ if ($mform_post->is_cancelled()) {
|
||||
$message = '';
|
||||
$addpost = $fromform;
|
||||
$addpost->forum=$forum->id;
|
||||
if ($fromform->id = forum_add_new_post($addpost, $mform_post, $message)) {
|
||||
if ($fromform->id = forum_add_new_post($addpost, $mform_post)) {
|
||||
$subscribemessage = forum_post_subscription($fromform, $forum, $discussion);
|
||||
|
||||
if (!empty($fromform->mailnow)) {
|
||||
@ -903,7 +903,7 @@ if ($mform_post->is_cancelled()) {
|
||||
|
||||
$discussion->groupid = $group;
|
||||
$message = '';
|
||||
if ($discussion->id = forum_add_discussion($discussion, $mform_post, $message)) {
|
||||
if ($discussion->id = forum_add_discussion($discussion, $mform_post)) {
|
||||
|
||||
$params = array(
|
||||
'context' => $modcontext,
|
||||
|
Loading…
x
Reference in New Issue
Block a user