]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18518 user firstaccess - added suport to display user->firstaccess. Credit goes...
authorstronk7 <stronk7>
Wed, 11 Mar 2009 11:22:55 +0000 (11:22 +0000)
committerstronk7 <stronk7>
Wed, 11 Mar 2009 11:22:55 +0000 (11:22 +0000)
Merged from 19_STABLE

admin/settings/users.php
lang/en_utf8/moodle.php
lib/moodlelib.php
user/view.php

index d0f00ecc1cfb4194666f85ce9a63b0664ceb1385..102f38557b0b6cee155b2a902e267aec136a5041 100644 (file)
@@ -161,6 +161,7 @@ if ($hassiteconfig
                              'yahooid' => get_string('yahooid'),
                              'aimid' => get_string('aimid'),
                              'msnid' => get_string('msnid'),
+                             'firstaccess' => get_string('firstaccess'),
                              'lastaccess' => get_string('lastaccess'),
                              'mycourses' => get_string('mycourses'))));
 
index d6ef84212c3a948bc483f5d8d17010cee8bd8f02..154f97f6db3aa019b44473b569656eed61b2028f 100644 (file)
@@ -672,6 +672,7 @@ $string['filesfolders'] = 'Files/folders';
 $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?';
index 866f1952ad814e605d891ea91cbbb1f71c15a5e1..75ff6179b8e7d42dd8393de14da2ec47655b98af 100644 (file)
@@ -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)
 
index e8983df682238f4a1cf3bf2ba6546a52d51f94ac..8cb7078383cd38bb9eff767dfd6ab065f7bf3f31 100644 (file)
             print_row(get_string('courses').':', rtrim($courselisting,', '));
         }
     }
-
+    if (!isset($hiddenfields['firstaccess'])) {
+        if ($user->firstaccess) {
+            $datestring = userdate($user->firstaccess)."&nbsp; (".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)."&nbsp; (".format_time(time() - $user->lastaccess).")";