Skip to content

Commit

Permalink
Merge branch 'MDL-55632-31' of git://github.com/andrewnicols/moodle i…
Browse files Browse the repository at this point in the history
…nto MOODLE_31_STABLE
  • Loading branch information
stronk7 committed Sep 12, 2016
2 parents 1a3c879 + fcc0c4c commit bbe5329
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
30 changes: 12 additions & 18 deletions mod/forum/lib.php
Expand Up @@ -4331,16 +4331,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));
Expand Down Expand Up @@ -4379,18 +4376,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));
Expand Down Expand Up @@ -4419,7 +4413,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);
Expand Down
10 changes: 5 additions & 5 deletions mod/forum/post.php
Expand Up @@ -729,7 +729,7 @@
}
$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);
}

Expand All @@ -741,10 +741,10 @@
}

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);
Expand Down Expand Up @@ -790,7 +790,7 @@
$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)) {
Expand Down Expand Up @@ -903,7 +903,7 @@

$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,
Expand Down

0 comments on commit bbe5329

Please sign in to comment.