MDL-28186 messaging: Fix "Enable messagning setting" infuence on the menus
"Enable messaging system" (Site administration > Advanced features) is supposed to control messaging between site users only, thus it should not remove user messging preferences menu item. However, it may remove instant messging preferences from providers list for the user. Signed-off-by: Ruslan Kabalin <[email protected]>
This commit is contained in:
committed by
Eloy Lafuente (stronk7)
parent
1541d1a36b
commit
661dd2cf61
+5
-1
@@ -373,7 +373,7 @@ function message_get_my_providers() {
|
||||
* @return array of message providers
|
||||
*/
|
||||
function message_get_providers_for_user($userid) {
|
||||
global $DB;
|
||||
global $DB, $CFG;
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
@@ -386,6 +386,10 @@ function message_get_providers_for_user($userid) {
|
||||
unset($providers[$providerid]); // Not allowed to see this
|
||||
}
|
||||
}
|
||||
// Ensure user is not allowed to configure instantmessage if it is globally disabled.
|
||||
if (!$CFG->messaging && $provider->name == 'instantmessage') {
|
||||
unset($providers[$providerid]);
|
||||
}
|
||||
}
|
||||
|
||||
return $providers;
|
||||
|
||||
@@ -3673,8 +3673,7 @@ class settings_navigation extends navigation_node {
|
||||
// Messaging
|
||||
if (($currentuser && has_capability('moodle/user:editownmessageprofile', $systemcontext)) || (!isguestuser($user) && has_capability('moodle/user:editmessageprofile', $usercontext) && !is_primary_admin($user->id))) {
|
||||
$url = new moodle_url('/message/edit.php', array('id'=>$user->id, 'course'=>$course->id));
|
||||
// Hide the node if messaging disabled
|
||||
$usersetting->add(get_string('editmymessage', 'message'), $url, self::TYPE_SETTING)->display = !empty($CFG->messaging);
|
||||
$usersetting->add(get_string('editmymessage', 'message'), $url, self::TYPE_SETTING);
|
||||
}
|
||||
|
||||
// Blogs
|
||||
|
||||
Reference in New Issue
Block a user