Archive for October, 2016

  • Delete inactive Drupal users – sql query

    Delete inactive Drupal users – sql query

    Delete users who have no role assigned, created no content and who have not logged in in a few years: DELETE u.* FROM users u LEFT JOIN users_roles r on u.uid = r.uid LEFT JOIN node n ON u.uid = n.uid WHERE r.rid IS NULL AND n.nid IS NULL AND u.login < 1400000000 AND u.uid > […]

    Read more »
  • Export all 404 errors stored in Drupal database log

    Export all 404 errors stored in Drupal database log

    A drush command to export a text file with all 404s on your site and how often they occur: drush sql-query “SELECT count(*) as num_rows, message from watchdog WHERE type = ‘page not found’ group by message order by num_rows desc;” –result-file=404s.txt

    Read more »