]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19697 mnet auth - start saving user->firstaccess ; merged from 19_STABLE
authorEloy Lafuente <stronk7@moodle.org>
Fri, 27 Nov 2009 14:50:25 +0000 (14:50 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Fri, 27 Nov 2009 14:50:25 +0000 (14:50 +0000)
auth/mnet/auth.php

index 5da68394cd35dfe35c787b82ef62df6c9d7fa9c3..ab077213b4fec89ea3864c1a3204631dd6f07a7b 100644 (file)
@@ -295,6 +295,7 @@ class auth_plugin_mnet extends auth_plugin_base {
                 print_error('nolocaluser', 'mnet');
             }
             $remoteuser->mnethostid = $remotehost->id;
+            $remoteuser->firstaccess = time(); // First time user in this server, grab it here
             $DB->insert_record('user', $remoteuser);
             $firsttime = true;
             if (! $localuser = $DB->get_record('user', array('username'=>$remoteuser->username, 'mnethostid'=>$remotehost->id))) {
@@ -366,6 +367,9 @@ class auth_plugin_mnet extends auth_plugin_base {
         }
 
         $localuser->mnethostid = $remotepeer->id;
+        if (empty($localuser->firstaccess)) { // Now firstaccess, grab it here
+            $localuser->firstaccess = time();
+        }
 
         $DB->update_record('user', $localuser);