Skip to content

Commit

Permalink
MDL-47238 core_user: added an error message if guests access user pro…
Browse files Browse the repository at this point in the history
…files and they aren't allowed to
  • Loading branch information
andyjdavis committed Sep 22, 2014
1 parent cbc60dd commit a18b4d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions lang/en/error.php
Expand Up @@ -262,6 +262,7 @@
$string['groupingnotaddederror'] = 'Grouping "{$a}" not added';
$string['groupunknown'] = 'Group {$a} not associated to specified course';
$string['groupusernotmember'] = 'User is not member of this group.';
$string['guestcantaccessprofiles'] = 'Guests cannot access user profiles. Log in with a full user account to continue.';
$string['guestnocomment'] = 'Guests are not allowed to post comments!';
$string['guestnoeditprofile'] = 'The guest user cannot edit their profile';
$string['guestnoeditprofileother'] = 'The guest user profile cannot be edited';
Expand Down
9 changes: 8 additions & 1 deletion user/profile.php
Expand Up @@ -50,7 +50,14 @@
require_login();
if (isguestuser()) {
$SESSION->wantsurl = $PAGE->url->out(false);
redirect(get_login_url());

$PAGE->set_context(context_system::instance());
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('guestcantaccessprofiles', 'error'),
get_login_url(),
$CFG->wwwroot);
echo $OUTPUT->footer();
die;
}
} else if (!empty($CFG->forcelogin)) {
require_login();
Expand Down

0 comments on commit a18b4d1

Please sign in to comment.