[wp-hackers] How to know if a user has never logged in?
johnbillion+wp at gmail.com
Sat Aug 8 03:17:51 UTC 2009
The way that I do it is to check for the wp_capabilities usermeta
field. This value only gets set to something the first time a user
logs in. Not ideal, but saves adding an extra meta field.
if ( get_usermeta( $user_id, $wpdb->prefix . 'capabilities' ) )
// user has logged in at least once
// user has never logged in
Definitely the need for a proper API method though.
2009/8/7 Jordi Canals <jordi at jcanals.net>:
> Hi to all,
> I'm writing a plugin for on site who want to prune all users that have never
> logged in. It has be done one week after registration.
> I have the registration date on the users table but didn't find in the API
> nor the database any field that tracks id the use has logged in after
> What I've done is: to save a user metadata with the last login date. and use
> this to know if them have ever logged to the blog.
> Just want to know if WP provides a better way to know if a user has ever
> logged into the blog.
> Thanks in advance,
> Jordi Canals
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers