mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +02:00
MDL-29844 Administration: Added new config for users to login for viewing profile image
This commit is contained in:
parent
929c26ccf1
commit
e4b1208377
5 changed files with 10 additions and 3 deletions
|
@ -3404,8 +3404,10 @@ function file_pluginfile($relativepath, $forcedownload) {
|
|||
$themename = array_shift($args);
|
||||
$filename = array_shift($args);
|
||||
}
|
||||
if ((!empty($CFG->forcelogin) and !isloggedin())) {
|
||||
if ((!empty($CFG->forcelogin) and !isloggedin()) ||
|
||||
(!empty($CFG->forceloginforprofileimage) && (!isloggedin() || isguestuser()))) {
|
||||
// protect images if login required and not logged in;
|
||||
// also if login is required for profile images and is not logged in or guest
|
||||
// do not use require_login() because it is expensive and not suitable here anyway
|
||||
$redirect = true;
|
||||
}
|
||||
|
|
|
@ -276,8 +276,10 @@ class user_picture implements renderable {
|
|||
$renderer = $page->get_renderer('core');
|
||||
}
|
||||
|
||||
if (!empty($CFG->forcelogin) and !isloggedin()) {
|
||||
if ((!empty($CFG->forcelogin) and !isloggedin()) ||
|
||||
(!empty($CFG->forceloginforprofileimage) && (!isloggedin() || isguestuser()))) {
|
||||
// protect images if login required and not logged in;
|
||||
// also if login is required for profile images and is not logged in or guest
|
||||
// do not use require_login() because it is expensive and not suitable here anyway
|
||||
return $renderer->pix_url('u/f1');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue