ElearningWorld.org

For the online learning world

MoodleTechnical

MySQL query – recent users

Occasionally I post some MySQL queries on Moodle.org I’ve found useful administering Moodle sites.

Here’s a nice simple query, but very useful for a quick check on who’s been logging into your site recently.

SELECT id,username,FROM_UNIXTIME(`lastlogin`) AS days
 FROM `prefix_user`
 WHERE DATEDIFF(NOW(),FROM_UNIXTIME(`lastlogin`) ) < 7

If you don’t know how to use a query like this in your Moodle site don’t worry, I’m gong to be posting some hints and tips on how to use MySQL queries with Moodle over the coming months.  And if you DO know how to query your database, you can use and easily adapt this query smile

Stuart Mealor
Latest posts by Stuart Mealor (see all)

Stuart Mealor

Stuart is interested in all things e-learning, with specific interests in Moodle, e-learning strategy, and business development. His experience in education over 30 years, MBA in International Business, and knowledge of e-learning systems implementation, together with graphic design background, give him a unique skill set for e-learning projects.

One thought on “MySQL query – recent users

  • I like to think that an Moodle admin can have a pedagogical cap without special skill in this strange language 😉 ….Provided that to have a good network engineer in his team or a webmaster competent …Or a good external partner as an Moodle Partner 🙂

    Reply

Add a reply or comment...