tag_set('post', $post->id, array());
add_to_log(SITEID, 'blog', 'delete', 'index.php?userid='. $post->userid, 'deleted blog entry with entry id# '. $post->id);
-
- if (!$status) {
- print_error('deleteposterror', 'blog', $returnurl);
- }
}
/**
$post->created = time();
// Insert the new blog entry.
- if ($post->id = $DB->insert_record('post', $post)) {
- // Add blog attachment
- if ($blogeditform->get_new_filename('attachment')) {
- if ($blogeditform->save_stored_file('attachment', SYSCONTEXTID, 'blog', $post->id, '/', false, $USER->id)) {
- $DB->set_field("post", "attachment", 1, array("id"=>$post->id));
- }
+ $post->id = $DB->insert_record('post', $post);
+ // Add blog attachment
+ if ($blogeditform->get_new_filename('attachment')) {
+ if ($blogeditform->save_stored_file('attachment', SYSCONTEXTID, 'blog', $post->id, '/', false, $USER->id)) {
+ $DB->set_field("post", "attachment", 1, array("id"=>$post->id));
}
-
- // Update tags.
- tag_set('post', $post->id, $post->tags);
-
- add_to_log(SITEID, 'blog', 'add', 'index.php?userid='.$post->userid.'&postid='.$post->id, $post->subject);
-
- } else {
- print_error('deleteposterror', 'blog', $returnurl);
}
+ // Update tags.
+ tag_set('post', $post->id, $post->tags);
+
+ add_to_log(SITEID, 'blog', 'add', 'index.php?userid='.$post->userid.'&postid='.$post->id, $post->subject);
}
/**
}
// Update record
- if ($DB->update_record('post', $post)) {
- tag_set('post', $post->id, $post->tags);
+ $DB->update_record('post', $post);
+ tag_set('post', $post->id, $post->tags);
- add_to_log(SITEID, 'blog', 'update', 'index.php?userid='.$USER->id.'&postid='.$post->id, $post->subject);
-
- } else {
- print_error('deleteposterror', 'blog', $returnurl);
- }
+ add_to_log(SITEID, 'blog', 'update', 'index.php?userid='.$USER->id.'&postid='.$post->id, $post->subject);
}
?>
$string['courseblogs'] = 'Users can only see blogs for people who share a course';
$string['donothaveblog'] = 'You do not have your own blog, sorry.';
$string['deleteotagswarn'] = 'Are you sure you want to remove this / these tags <br />from all blog posts and remove it from the system?';
-$string['deleteposterror'] = 'Error occured while deleting post';
$string['disableblogs'] = 'Disable blog system completely';
$string['emptybody'] = 'Blog entry body can not be empty';
$string['emptytitle'] = 'Blog entry title can not be empty';
$string['cannotcreatetempdir'] = 'Cannot create temp directory';
$string['cannotcreatesitedir'] = 'Cannot create site folder. The site administrator needs to fix the file permissions.';
$string['cannotcreateuploaddir'] = 'Cannot create upload folder. The site administrator needs to fix the file permissions.';
-$string['cannotcreateuser'] = 'Error creating user record';
$string['cannotcreateorfindstructs'] = 'Error finding or creating section structures for this course';
$string['cannotcreatepopupwin'] = 'Undefined element - cannot create pop-up window';
$string['cannotcustomisefiltersblockuser'] = 'You cannot customise filters settings in user or block contexts.';
$data = $this->get_record_data();
- if (!$DB->update_record($this->table, $data)) {
- return false;
- }
+ $DB->update_record($this->table, $data);
if (empty($CFG->disablegradehistory)) {
unset($data->timecreated);
$data = $this->get_record_data();
- if (!$this->id = $DB->insert_record($this->table, $data)) {
- debugging("Could not insert object into db");
- return false;
- }
+ $this->id = $DB->insert_record($this->table, $data);
// set all object properties from real db data
$this->update_from_db();
$goc = new object();
$goc->courseid = $courseid;
$goc->outcomeid = $this->id;
- return (bool)$DB->insert_record('grade_outcomes_courses', $goc);
+ $DB->insert_record('grade_outcomes_courses', $goc);
}
return true;
}
print_error('unknowformat', '', '', $glossary->displayformat);
}
- if ($returnid = $DB->insert_record("glossary", $glossary)) {
- $glossary->id = $returnid;
- glossary_grade_item_update($glossary);
- }
+ $returnid = $DB->insert_record("glossary", $glossary);
+ $glossary->id = $returnid;
+ glossary_grade_item_update($glossary);
return $returnid;
}
print_error('unknowformat', '', '', $glossary->displayformat);
}
- if ($return = $DB->update_record("glossary", $glossary)) {
- if ($glossary->defaultapproval) {
- $DB->execute("UPDATE {glossary_entries} SET approved = 1 where approved <> 1 and glossaryid = ?", array($glossary->id));
- }
- glossary_grade_item_update($glossary);
+ $return = $DB->update_record("glossary", $glossary);
+ if ($glossary->defaultapproval) {
+ $DB->execute("UPDATE {glossary_entries} SET approved = 1 where approved <> 1 and glossaryid = ?", array($glossary->id));
}
+ glossary_grade_item_update($glossary);
return $return;
}
$usernew->mnethostid = $CFG->mnet_localhost_id; // always local user
$usernew->confirmed = 1;
$usernew->password = hash_internal_user_password($usernew->newpassword);
- if (!$usernew->id = $DB->insert_record('user', $usernew)) {
- print_error('cannotcreateuser');
- }
+ $usernew->id = $DB->insert_record('user', $usernew);
$usercreated = true;
} else {
- if (!$DB->update_record('user', $usernew)) {
- print_error('cannotupdateuser', 'message');
- }
+ $DB->update_record('user', $usernew);
// pass a true $userold here
if (! $authplugin->user_update($user, $userform->get_data())) {
// auth update failed, rollback for moodle
print_continue("$CFG->wwwroot/user/view.php?id=$user->id");
} else {
// update user email
- if (!$DB->set_field('user', 'email', $user->email, array('id' => $user->id))) {
- print_error('cannotupdateuser');
- } else {
- events_trigger('user_updated', $user);
- $a->email = $user->email;
- $stremailupdatesuccess = get_string('auth_emailupdatesuccess', 'auth', $a);
- print_box($stremailupdatesuccess, 'center');
- print_continue("$CFG->wwwroot/user/view.php?id=$user->id");
- }
+ $DB->set_field('user', 'email', $user->email, array('id' => $user->id));
+ events_trigger('user_updated', $user);
+ $a->email = $user->email;
+ $stremailupdatesuccess = get_string('auth_emailupdatesuccess', 'auth', $a);
+ print_box($stremailupdatesuccess, 'center');
+ print_continue("$CFG->wwwroot/user/view.php?id=$user->id");
}
} else {