Skip to content

Commit

Permalink
MDL-16182 Loosening the api a bit, solves the issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Aug 23, 2008
1 parent db1d500 commit dbf4d66
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mod/forum/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ function forum_add_instance($forum) {
$discussion->mailnow = false;
$discussion->groupid = -1;

if (! forum_add_discussion($discussion, $discussion->intro)) {
$message = '';

if (! forum_add_discussion($discussion, null, $message)) {
error('Could not add the discussion for this forum');
}
}
Expand Down Expand Up @@ -3971,10 +3973,13 @@ function forum_pluginfile($course, $cminfo, $context, $filearea, $args) {
* @param $newfile is a full upload array from $_FILES
* @param $message is a string to hold the messages.
*/
function forum_add_attachment($post, $cm, $mform, &$message, $remove_previous=true) {
function forum_add_attachment($post, $cm, $mform=null, &$message=null, $remove_previous=true) {
global $CFG, $DB, $USER;

//TODO: add message when overwriting
if (empty($mform)) {
return false;
}

$filename = $mform->get_new_filename('attachment');
$filearea = 'forum_attachment';
Expand Down Expand Up @@ -4077,7 +4082,7 @@ function forum_update_post($post, $mform, &$message) {
* Given an object containing all the necessary data,
* create a new discussion and return the id
*/
function forum_add_discussion($discussion, $mform, &$message) {
function forum_add_discussion($discussion, $mform=null, &$message=null) {
global $USER, $CFG, $DB;

$timenow = time();
Expand Down

0 comments on commit dbf4d66

Please sign in to comment.