Permalink
Browse files

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 <ruslan.kabalin@luns.net.uk>
  • Loading branch information...
1 parent 81f8e0f commit 9f05a1a6404377173bf94d9c50cb2964a3c82cec Ruslan Kabalin committed Jul 5, 2011
Showing with 6 additions and 3 deletions.
  1. +5 −1 lib/messagelib.php
  2. +1 −2 lib/navigationlib.php
View
@@ -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;
View
@@ -3671,8 +3671,7 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr
// 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

0 comments on commit 9f05a1a

Please sign in to comment.