Skip to content

Commit

Permalink
MDL-49371 core_message: Unused method deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Mar 4, 2015
1 parent 4b38a19 commit bdc8327
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
26 changes: 26 additions & 0 deletions lib/deprecatedlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4100,3 +4100,29 @@ function enrol_cohort_search_cohorts(course_enrolment_manager $manager, $offset
}
return array('more' => !(bool)$limit, 'offset' => $offset, 'cohorts' => $cohorts);
}

/**
* Is $USER one of the supplied users?
*
* $user2 will be null if viewing a user's recent conversations
*
* @deprecated since Moodle 2.9 MDL-49371 - please do not use this function any more.
* @todo MDL-49290 This will be deleted in Moodle 3.1.
* @param stdClass the first user
* @param stdClass the second user or null
* @return bool True if the current user is one of either $user1 or $user2
*/
function message_current_user_is_involved($user1, $user2) {
global $USER;

debugging('message_current_user_is_involved() is deprecated, please do not use this function.', DEBUG_DEVELOPER);

if (empty($user1->id) || (!empty($user2) && empty($user2->id))) {
throw new coding_exception('Invalid user object detected. Missing id.');
}

if ($user1->id != $USER->id && (empty($user2) || $user2->id != $USER->id)) {
return false;
}
return true;
}
22 changes: 0 additions & 22 deletions message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2617,28 +2617,6 @@ function message_page_type_list($pagetype, $parentcontext, $currentcontext) {
return array('messages-*'=>get_string('page-message-x', 'message'));
}

/**
* Is $USER one of the supplied users?
*
* $user2 will be null if viewing a user's recent conversations
*
* @param stdClass the first user
* @param stdClass the second user or null
* @return bool True if the current user is one of either $user1 or $user2
*/
function message_current_user_is_involved($user1, $user2) {
global $USER;

if (empty($user1->id) || (!empty($user2) && empty($user2->id))) {
throw new coding_exception('Invalid user object detected. Missing id.');
}

if ($user1->id != $USER->id && (empty($user2) || $user2->id != $USER->id)) {
return false;
}
return true;
}

/**
* Get messages sent or/and received by the specified users.
*
Expand Down

0 comments on commit bdc8327

Please sign in to comment.