Skip to content

Commit

Permalink
MDL-18518 user firstaccess - added suport to display user->firstacces…
Browse files Browse the repository at this point in the history
…s. Credit goes to Anthony Borrow!

Merged from 19_STABLE
  • Loading branch information
stronk7 committed Mar 11, 2009
1 parent 692e0c3 commit 1263a0f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions admin/settings/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
'yahooid' => get_string('yahooid'),
'aimid' => get_string('aimid'),
'msnid' => get_string('msnid'),
'firstaccess' => get_string('firstaccess'),
'lastaccess' => get_string('lastaccess'),
'mycourses' => get_string('mycourses'))));

Expand Down
1 change: 1 addition & 0 deletions lang/en_utf8/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@
$string['filloutallfields'] = 'Please fill out all fields in this form';
$string['filter'] = 'Filter';
$string['findmorecourses'] = 'Find more courses...';
$string['firstaccess'] = 'First access';
$string['firstdayofweek'] = '0';
$string['firstname'] = 'First name';
$string['firsttime'] = 'Is this your first time here?';
Expand Down
4 changes: 4 additions & 0 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3099,6 +3099,10 @@ function authenticate_user_login($username, $password) {
$DB->set_field('user', 'auth', $auth, array('username'=>$username));
$user->auth = $auth;
}
if (empty($user->firstaccess)) { //prevent firstaccess from remaining 0 for manual account that never required confirmation
$DB->set_field('user','firstaccess', $user->timemodified, array('id' => $user->id));
$user->firstaccess = $user->timemodified;
}

update_internal_user_password($user, $password); // just in case salt or encoding were changed (magic quotes too one day)

Expand Down
9 changes: 8 additions & 1 deletion user/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,14 @@
print_row(get_string('courses').':', rtrim($courselisting,', '));
}
}

if (!isset($hiddenfields['firstaccess'])) {
if ($user->firstaccess) {
$datestring = userdate($user->firstaccess)."  (".format_time(time() - $user->firstaccess).")";
} else {
$datestring = get_string("never");
}
print_row(get_string("firstaccess").":", $datestring);
}
if (!isset($hiddenfields['lastaccess'])) {
if ($user->lastaccess) {
$datestring = userdate($user->lastaccess)."  (".format_time(time() - $user->lastaccess).")";
Expand Down

0 comments on commit 1263a0f

Please sign in to comment.