Ankit Sudhera Portfolio Website

Programming is my Passion
Provide Training is my skill
Quality and Commitment is my Life's Goal
Quality and Commitment is my Life's Goal
Programming is my Passion
Provide Training is my skill
Quality and Commitment is my Life's Goal
Quality and Commitment is my Life's Goal
Programming and Support is my Quality
Programming and Support is my Quality
Programming and Support is my Quality

Forum

How to show user lo...
 
Notifications
Clear all

How to show user login times for WordPress site without plugin using MySQL Query

2 Posts
1 Users
0 Reactions
103 Views
(@ankitbnl406)
Member Admin
Joined: 3 years ago
Posts: 13
Topic starter  

You can do it without using plugin with the following SQL query to fetch and show the records. But please create a page separately.

"

SELECT user_id, wp_users.user_login, FROM_UNIXTIME(substring_index(substring_index(meta_value, '"login";i:', -1), ';}}', 1)) as last_login FROM wp_usermeta inner join wp_users on user_id = wp_users.ID WHERE meta_key='session_tokens' ORDER BY `last_login` DESC

"

You can replace the table name wp with your table name prefix.

If you have any questions, please comments or contact us.


   
Quote
(@ankitbnl406)
Member Admin
Joined: 3 years ago
Posts: 13
Topic starter  

More details with following:

"

SELECT u.ID, u.user_login, u.user_email, u.user_registered, u.display_name, FROM_UNIXTIME(SUBSTRING_INDEX(SUBSTRING_INDEX(m.meta_value,'\"login\";i:',-1),';}}',1)) AS last_login, FROM_UNIXTIME(SUBSTRING_INDEX(SUBSTRING_INDEX(m.meta_value,'\"expiration\";i:',-1),';',1)) AS logout_time FROM wp_users u LEFT JOIN wp_usermeta m ON u.ID=m.user_id AND m.meta_key='session_tokens' ORDER BY last_login DESC

"


   
ReplyQuote