Drupal

Upgrading, and a Drupal 5 version of the quotefilter module

Shocks! As promised, what, not far off a month ago, a few upgradey things have happened around here. Still running on Drupal, just a shinier, newer, still-in-development version. The upgrade wasn't so difficult but a few annoying things happened. The main trauma was that after getting a backup restore down by the hosts after an issue with the lovely image assist module made itself known, they added all the old tables back to the database, leaving anything with a new name in, rather than the cleaner method of dropping the database and starting again. This caused all sorts of later dodgy issues as the installer couldn't create tables it thought it should, modules thought they already upgraded when they didn't and so on. But it's done now.

As the Poorhouse took his goddamned time upgrading, the only thing that no kind soul had basically already done module-wise was convert the quotefilter module from Drupal 4.7 to Drupal 5.x code.. Luckily it was super easy to do.

Fixing the spam module mysql_real_escape_string error

Kernaltrap has an excellent Drupal anti-spam module which is used to great effect at the present time on this site. Recently it was set to moderate forum posts (which in Drupal terminology are themselves nodes) and errors started appearing in the watchdog logs every time the cron tasks were run.

mysql_real_escape_string() expects parameter 1 to be string, array given in /usr/home/adam/public_html/includes/database.mysql.inc on line 350.

and

Unknown column 'n.revision_timestamp' in 'where clause' query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE n.nid = '835' AND n.vid = '835' AND n.type = 'forum' AND n.status = '0' AND n.created = '1165946854' AND n.changed = '1165946854' AND n.comment = '2' AND n.promote = '0' AND n.moderate = '0' AND n.sticky = '0' AND n.revision_timestamp = '1165946854' AND n.title = 'Merry Christmas Site' AND n.body = '<a href=\"http://xanaxaxa.blogspot.com\">xanax</a> \r\n<a href=\"http://phenne.blogspot.com\">phentermine</a> \r\n<a href=\"http://tramadol400.blo in /usr/home/adam/public_html/includes/database.mysql.inc on line 121.

Adding a no wordwrap option to img_assist

Note: this article is outdated now as the official Image Assist module now contains a no-word-wrap feature within it.

The Poorhouse's current favourite way of easily inserting images into Drupal nodes is to use the module img_assist. To use it, you also need to install the image module.

Controlling who sees a block in Drupal

You can configure Drupal block visibility under Admin -> Blocks -> Configure. One option is "expert mode" whereby you can write a snippet of PHP code. If it returns true, the block is shown, otherwise it is hidden.

Drupal "save as draft" feature

Recently the Poorhouse wanted some sort of "Save as draft" facility, such that a (fabulous) article could be started at one point in time, saved - without being published - and continued some other time. Also the option to decide whether to publish to the front page or not on a case-by-case basis was desired - after all you don't want every last bit of the inner workings of your mind highlighted for all to see. At least make them work for it.

Drupal contains this feature, under "Publishing options". However, this is only available to the initial admin user, plus anyone who has node edit privileges. The Poorhouse wanted its guest authors it have this facility too. However giving them node edit privileges was not quite right, because it meant they could edit, delete and otherwise have finger-slips over everyone's articles and not just their own.

Drupal stuff

The Poorhouse uses a content management framework called Drupal. Drupal is great. It may be a bit complex to get your head around at first, but it is ultra flexible, modular, decent user community and so on.

This page will contain links to a few notes the Poorhouse has made during the adventure into Drupal, mostly so the Poorhouse can remember what he did if it needs doing it again, but maybe, just maybe, it'll be of interest to other avid readers.

Converting Drupal Acidfree module to mySQL 3.x

See here for an explanation. Basically, this is how thepoorhouse.org.uk converted the Drupal module "Acidfree" which is designed for mySQL 4 and above to run on mySQL 3.

Converting Drupal Workspace module to mySQL 3.x

See here for an explanation. Basically, this is how thepoorhouse.org.uk converted the Drupal module "Workspace" which is designed for mySQL 4 and above to run on mySQL 3.

Drupal modules on mySQL 3

The Poorhouse tends to use cheap hosting...which whilst bargainous, means you don't get the latest and greatest software. Most importantly here, it only has mySQL 3.x. mySQL 3 is missing a few features, including the UNION sql operator. Whilst this is fine for Drupal core, some of the modules rely on its existence. Which is fair enough all considered - but annoying for us.

Two such modules are Workspace and AcidFree. Both very useful, but required some faffing around to transform into something mySQL 3 compatible. In case anyone is in a similar situation, here's what was done to make them work to an acceptable standard.

Syndicate content