I am trying to write/find a report that will allow me to find users who are not enrolled in any courses and have never logged into the system
What I need is username, first name, last name, time created, last access for users who are not enrolled in any course.
My goal is a list of users who can be deleted. Almost 1/4 of our users have never been in Moodle and were created more than 2.5 years ago, and we are hoping to cut our user numbers down.
I have a report that gives me the list of users who have never logged in (see below). Would I need to tie in the user_enrolments status field? I have another report created by Gemma Lesterhuis that gives me all of the users with their courses
SELECT id AS 'User ID',
idnumber AS 'ID number',
username AS 'User Name',
deleted AS 'Flagged deleted',
firstname AS 'First Name',
lastname AS 'Last Name',
email AS 'Email Address',
timecreated AS 'UNIX time created',
FROM_UNIXTIME (timecreated, '%d/%m/%Y') AS 'Time Created',
FROM_UNIXTIME (lastaccess, '%d/%m/%Y') AS 'Last Access'
FROM prefix_user
WHERE lastaccess='0'
AND timecreated < 1356912000 /*before 01/01/13*/
AND deleted =0
ORDER BY timecreated ASC, CAST(id AS UNSIGNED) ASC