From 356a6de3511972be1db86de76db7e7b822b4e2e3 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Thu, 6 Oct 2011 14:00:13 +1300 Subject: [PATCH] MDL-27058 navigation: Added a setting to control whether user forum links are added --- admin/settings/appearance.php | 1 + lang/en/admin.php | 2 ++ lib/navigationlib.php | 14 ++++++++------ version.php | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index 36a287b3b2d..1646cab08f2 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -93,6 +93,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page $temp->add(new admin_setting_configtext('navcourselimit',get_string('navcourselimit','admin'),get_string('confignavcourselimit', 'admin'),20,PARAM_INT)); $temp->add(new admin_setting_configcheckbox('navlinkcoursesections', get_string('navlinkcoursesections', 'admin'), get_string('navlinkcoursesections_help', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', get_string('usesitenameforsitepages', 'admin'), get_string('configusesitenameforsitepages', 'admin'), 0)); + $temp->add(new admin_setting_configcheckbox('navadduserpostslinks', get_string('navadduserpostslinks', 'admin'), get_string('navadduserpostslinks_help', 'admin'), 1)); $ADMIN->add('appearance', $temp); diff --git a/lang/en/admin.php b/lang/en/admin.php index 683da5c4126..03c0ed706c8 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -684,6 +684,8 @@ $string['myprofile'] = 'Default profile page'; $string['mypagelocked'] = 'Lock default page'; $string['mysql416bypassed'] = 'However, if your site is using iso-8859-1 (latin) languages ONLY, you may continue using your currently installed MySQL 4.1.12 (or higher).'; $string['mysql416required'] = 'MySQL 4.1.16 is the minimum version required for Moodle 1.6 in order to guarantee that all data can be converted to UTF-8 in the future.'; +$string['navadduserpostslinks'] = 'Add links to view user posts'; +$string['navadduserpostslinks_help'] = 'If enabled two links will be added to each user in the navigation to view discussions the user has started and posts the user has made in forums throughout the site or in specific courses.'; $string['navigationupgrade'] = 'This upgrade introduces two new navigation blocks that will replace these blocks: Administration, Courses, Activities and Participants. If you had set any special permissions on those blocks you should check to make sure everything is behaving as you want it.'; $string['navcourselimit'] = 'Course limit'; $string['navlinkcoursesections'] = 'Link course sections'; diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 0c88ad06a4a..b8d30790261 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -1893,12 +1893,14 @@ class global_navigation extends navigation_node { } } - // Add nodes for forum posts and discussions if the user can view either or both - // There are no capability checks here as the content of the page is based - // purely on the forums the current user has access too. - $forumtab = $usernode->add(get_string('forumposts', 'forum')); - $forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs)); - $forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', array_merge($baseargs, array('mode'=>'discussions')))); + if (!empty($CFG->navadduserpostslinks)) { + // Add nodes for forum posts and discussions if the user can view either or both + // There are no capability checks here as the content of the page is based + // purely on the forums the current user has access too. + $forumtab = $usernode->add(get_string('forumposts', 'forum')); + $forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs)); + $forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', array_merge($baseargs, array('mode'=>'discussions')))); + } // Add blog nodes if (!empty($CFG->bloglevel)) { diff --git a/version.php b/version.php index f9757d8e7e9..7fbde6fe6a9 100644 --- a/version.php +++ b/version.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2011100700.01; // YYYYMMDD = weekly release date of this DEV branch +$version = 2011101000.00; // YYYYMMDD = weekly release date of this DEV branch // RR = release increments - 00 in DEV branches // .XX = incremental changes