apljdi, that's a great idea. Thanks for sharing. I ended up creating two functions (based off your original one) and pasted them in my functions.php file.
function appthemes_last_login($login) {
global $user_ID;
$user = get_userdatabylogin($login);
update_usermeta($user->ID, 'last_login', current_time('mysql'));
}
add_action('wp_login','appthemes_last_login');
function appthemes_get_last_login($user_id) {
$last_login = get_user_meta($user_id, 'last_login', true);
$date_format = get_option('date_format') . ' ' . get_option('time_format');
$the_last_login = mysql2date($date_format, $last_login, false);
echo $the_last_login;
}
Then to call this from any of your theme pages, just paste in this code:
<?php
global $userdata;
get_currentuserinfo();
?>
<?php _e('You last logged in at:','appthemes'); ?> <?php appthemes_get_last_login($userdata->ID); ?>
This makes it easy to pull the last login date and also it also uses the WordPress date/time formats you set on your blog settings page. Hope that helps you all.
~David
AppThemes