Created
June 27, 2016 08:03
-
-
Save jakelacey2012/a75c54e0359ad2b1f6e4fad07c4fe967 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Helper function to insert the user thats logged in | |
* to the database | |
*/ | |
function JwLanalytics_track_user_data_login($uid) { | |
try { | |
$timestamp = time(); | |
db_insert('users_logins_data') | |
->fields( array( | |
'uid' => $uid, | |
'timestamp' => $timestamp | |
)) | |
->execute(); | |
JwLanalytics_expired_users_login_data(); // lets clean up the table after inserting stuff.a | |
} catch(PDOException $e) { | |
print $e; die; | |
} | |
} | |
/** | |
* Implements hook_user_login(). | |
*/ | |
function JwLanalytics_user_login(&$edit, $account) { | |
JwLanalytics_track_user_data_login($account->uid); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment