mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 19:06:41 +02:00
[MDL-23317]
fixing issue with get_complete_user_data and improving related wiki comments functions
This commit is contained in:
parent
a26a1a5b54
commit
9ffd2726df
2 changed files with 17 additions and 43 deletions
|
@ -526,10 +526,11 @@ function wiki_search_all($swid, $search) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get complete set of user data
|
||||
* Get user data
|
||||
*/
|
||||
function wiki_get_user_info($userid) {
|
||||
return get_complete_user_data('id', $userid);
|
||||
global $DB;
|
||||
return $DB->get_record('user', array('id' => $userid));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1081,38 +1082,10 @@ function wiki_get_comment($commentid){
|
|||
* @param $context. Current context
|
||||
* @param $pageid. Current pageid
|
||||
**/
|
||||
function wiki_get_comments($context, $pageid) {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/comment/lib.php');
|
||||
list($context, $course, $cm) = get_context_info_array($context->id);
|
||||
|
||||
$cmt = new stdclass();
|
||||
$cmt->context = $context;
|
||||
$cmt->itemid = $pageid;
|
||||
$cmt->pluginname = 'wiki';
|
||||
$cmt->area = 'wiki_page';
|
||||
$cmt->course = $course;
|
||||
$manager = new comment($cmt);
|
||||
|
||||
return ($manager->get_comments());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all comments from wiki comments section by user
|
||||
*
|
||||
* @param $userid. User whose we want get the comments
|
||||
**/
|
||||
function wiki_get_comments_by_user($userid) {
|
||||
function wiki_get_comments($contextid, $pageid) {
|
||||
global $DB;
|
||||
|
||||
$area = 'wiki_page';
|
||||
$sql = "SELECT c.*
|
||||
FROM {comments} c
|
||||
WHERE c.userid = ? and c.commentarea = ?";
|
||||
|
||||
return $DB->get_records_sql($sql, array($userid, $area));
|
||||
|
||||
return $DB->get_records('comments', array('contextid' => $contextid, 'itemid' => $pageid, 'commentarea' => 'wiki_page'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue