Drupal

Drupal items

  • Improving ‘time to first load’ and generating critical CSS for Drupal and WordPress sites

    Improving ‘time to first load’ and generating critical CSS for Drupal and WordPress sites

    This document is a work in progress…. One thing that we want to fix is ‘time to first load’. As you probably know, people are recommending to put as little in the way of initial loading as possible, and zero external requests. This means no blocking JS in head, and as little CSS as possible, […]

    Read more »
  • 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 »
  • Drupal Views: selecting number of items via argument

    Drupal Views: selecting number of items via argument

    Steps to reproduce: 1. Add argument Global:Null (it might work with other arguments as well, but this seemed the least intrusive) 2. Go to ‘Specify validation criteria’ select ‘php code’ and add this: $view->set_items_per_page($argument); return true; You don’t need to change anything else in the argument – however in the ‘More’ section it might be […]

    Read more »
  • WordPress-like summaries and Teasers in Drupal 7 and CKEditor

    WordPress-like summaries and Teasers in Drupal 7 and CKEditor

    Over the past few versions of Drupal, there have been quite a few attempts to create a good way of creating page summaries/teasers/excerpts/extracts that you can use on the front page to encourage people to read the article. The version that comes out of the box with Drupal 7 works quite nicely if no text […]

    Read more »
  • Adventures in Drupal 7 Caching

    Adventures in Drupal 7 Caching

    (This post will be updated as we get a clearer idea of what is going on and how all the pieces fit together) We have made quite a few sites in Drupal 7, the largest being http://www.srichinmoycentre.org. Drupal has evolved into a really powerful framework that can enable you to bring together all kinds of […]

    Read more »