Skip to content

Instantly share code, notes, and snippets.

@krschmidt
Last active November 7, 2015 23:38
Show Gist options
  • Save krschmidt/03eebf92699b2f65d73b to your computer and use it in GitHub Desktop.
Save krschmidt/03eebf92699b2f65d73b to your computer and use it in GitHub Desktop.
Recent Logins and Edits to Drupal
# users without any recent edits
select u.name, u.mail, n1.uid, n1.vid, n1.nid, from_unixtime(n1.timestamp) changed
from node_revision n1, users u
where n1.uid = u.uid
and timestamp=
(select max(timestamp)
from node_revision n2
where n2.uid=n1.uid) # this selects the most recent revision for each person
and from_unixtime(n1.timestamp) < date_sub(now(), interval 30 day)
and u.status = 1 # ignore people who are blocked
and u.login != 0 # ignore people who haven't ever logged in
group by uid
order by changed;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment