I'm trying to write a very simple plugin to track when users log in to wordpress. At the moment, it's not going well :-(
I can't understand why, but the below doesn't work. Any ideas why?
function access_log_insert_record()
{
global $current_user;
$cur_user = $current_user->user_login;
global $wpdb;
$table = $wpdb->prefix."access_log";
$wpdb->query("INSERT INTO $table (access_user, access_date_time) VALUES($cur_user, NOW()) ");
}
add_action('wp_login', 'access_log_insert_record');