]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17486 added option to make my courses list in user profile hidden
authorskodak <skodak>
Mon, 1 Dec 2008 22:06:33 +0000 (22:06 +0000)
committerskodak <skodak>
Mon, 1 Dec 2008 22:06:33 +0000 (22:06 +0000)
admin/settings/users.php
user/view.php

index 3f9c7b81ccf449db512c060c273bc4c7a8bcf3e5..43a99d802fffa644be1cd5955fe9c3e47a0ab74a 100644 (file)
@@ -161,7 +161,8 @@ if ($hassiteconfig
                              'yahooid' => get_string('yahooid'),
                              'aimid' => get_string('aimid'),
                              'msnid' => get_string('msnid'),
-                             'lastaccess' => get_string('lastaccess'))));
+                             'lastaccess' => get_string('lastaccess'),
+                             'mycourses' => get_string('mycourses'))));
 
         $temp->add(new admin_setting_configmulticheckbox('extrauserselectorfields',
                 get_string('extrauserselectorfields', 'admin'), get_string('configextrauserselectorfields', 'admin'), array('email' => '1'),
index 1bda459fedeff1ec1e06656ac4ab2f4e8c48f936..1809e60ff430645daed9d7df93ec3e82b285f449 100644 (file)
     profile_display_fields($user->id);
 
 
-    if ($mycourses = get_my_courses($user->id, null, null, false, 21)) {
-        $shown=0;
-        $courselisting = '';
-        foreach ($mycourses as $mycourse) {
-            if ($mycourse->category) {
-                if ($mycourse->id != $course->id){
-                    $class = '';
-                    if ($mycourse->visible == 0) {
-                        // get_my_courses will filter courses $USER cannot see
-                        // if we get one with visible 0 it just means it's hidden
-                        // ... but not from $USER
-                        $class = 'class="dimmed"';
+    if (!isset($hiddenfields['mycourses'])) {
+        if ($mycourses = get_my_courses($user->id, null, null, false, 21)) {
+            $shown=0;
+            $courselisting = '';
+            foreach ($mycourses as $mycourse) {
+                if ($mycourse->category) {
+                    if ($mycourse->id != $course->id){
+                        $class = '';
+                        if ($mycourse->visible == 0) {
+                            // get_my_courses will filter courses $USER cannot see
+                            // if we get one with visible 0 it just means it's hidden
+                            // ... but not from $USER
+                            $class = 'class="dimmed"';
+                        }
+                        $courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}\" $class >"
+                            . format_string($mycourse->fullname) . "</a>, ";
+                    }
+                    else {
+                        $courselisting .= format_string($mycourse->fullname) . ", ";
                     }
-                    $courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}\" $class >"
-                        . format_string($mycourse->fullname) . "</a>, ";
                 }
-                else {
-                    $courselisting .= format_string($mycourse->fullname) . ", ";
+                $shown++;
+                if($shown==20) {
+                    $courselisting.= "...";
+                    break;
                 }
             }
-            $shown++;
-            if($shown==20) {
-                $courselisting.= "...";
-                break;
-            }
+            print_row(get_string('courses').':', rtrim($courselisting,', '));
         }
-        print_row(get_string('courses').':', rtrim($courselisting,', '));
     }
 
     if (!isset($hiddenfields['lastaccess'])) {