Skip to content

Instantly share code, notes, and snippets.

@jakelacey2012
Created June 27, 2016 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakelacey2012/a75c54e0359ad2b1f6e4fad07c4fe967 to your computer and use it in GitHub Desktop.
Save jakelacey2012/a75c54e0359ad2b1f6e4fad07c4fe967 to your computer and use it in GitHub Desktop.
<?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