Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-29844 Administration: Added new config for users to login for vie…

…wing profile image
  • Loading branch information...
commit e4b1208377ace2d49f07fac2332f70037a99354d 1 parent 929c26c
Eloy Lafuente (stronk7) authored December 12, 2011 Rajesh Taneja committed January 03, 2012
1  admin/settings/security.php
@@ -16,6 +16,7 @@
16 16
     $temp->add(new admin_setting_configcheckbox('protectusernames', get_string('protectusernames', 'admin'), get_string('configprotectusernames', 'admin'), 1));
17 17
     $temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0));
18 18
     $temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 1));
  19
+    $temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', get_string('forceloginforprofileimage', 'admin'), get_string('forceloginforprofileimage_help', 'admin'), 0));
19 20
     $temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0));
20 21
     $temp->add(new admin_setting_pickroles('profileroles',
21 22
         get_string('profileroles','admin'),
2  lang/en/admin.php
@@ -516,6 +516,8 @@
516 516
 $string['filtersettingsgeneral'] = 'General filter settings';
517 517
 $string['filteruploadedfiles'] = 'Filter uploaded files';
518 518
 $string['forcelogin'] = 'Force users to login';
  519
+$string['forceloginforprofileimage'] = 'Force users to login to view user pictures';
  520
+$string['forceloginforprofileimage_help'] = 'If enabled, users must login in order to view user profile pictures and the default user picture will be used in all notification emails.';
519 521
 $string['forceloginforprofiles'] = 'Force users to login for profiles';
520 522
 $string['forcetimezone'] = 'Force default timezone';
521 523
 $string['frontpage'] = 'Front page';
4  lib/filelib.php
@@ -3404,8 +3404,10 @@ function file_pluginfile($relativepath, $forcedownload) {
3404 3404
                 $themename = array_shift($args);
3405 3405
                 $filename = array_shift($args);
3406 3406
             }
3407  
-            if ((!empty($CFG->forcelogin) and !isloggedin())) {
  3407
+            if ((!empty($CFG->forcelogin) and !isloggedin()) ||
  3408
+                    (!empty($CFG->forceloginforprofileimage) && (!isloggedin() || isguestuser()))) {
3408 3409
                 // protect images if login required and not logged in;
  3410
+                // also if login is required for profile images and is not logged in or guest
3409 3411
                 // do not use require_login() because it is expensive and not suitable here anyway
3410 3412
                 $redirect = true;
3411 3413
             }
4  lib/outputcomponents.php
@@ -276,8 +276,10 @@ public function get_url(moodle_page $page, renderer_base $renderer = null) {
276 276
             $renderer = $page->get_renderer('core');
277 277
         }
278 278
 
279  
-        if (!empty($CFG->forcelogin) and !isloggedin()) {
  279
+        if ((!empty($CFG->forcelogin) and !isloggedin()) ||
  280
+                (!empty($CFG->forceloginforprofileimage) && (!isloggedin() || isguestuser()))) {
280 281
             // protect images if login required and not logged in;
  282
+            // also if login is required for profile images and is not logged in or guest
281 283
             // do not use require_login() because it is expensive and not suitable here anyway
282 284
             return $renderer->pix_url('u/f1');
283 285
         }
2  version.php
@@ -30,7 +30,7 @@
30 30
 defined('MOODLE_INTERNAL') || die();
31 31
 
32 32
 
33  
-$version  = 2011120500.04;              // 20111205      = branching date YYYYMMDD - do not modify!
  33
+$version  = 2011120500.05;              // 20111205      = branching date YYYYMMDD - do not modify!
34 34
                                         //         RR    = release increments - 00 in DEV branches
35 35
                                         //           .XX = incremental changes
36 36
 

0 notes on commit e4b1208

Please sign in to comment.
Something went wrong with that request. Please try again.