image link to hive image link to ko-fi

drupal 7

Drupal 7 notes - Apache config

/etc/apache2/apache2.conf - find the directory bits and make sure the /var/www one looks like: <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> sudo a2enmod rewrite sudo a2enmod headers Make sure all the site configuration files in /etc/apache2/sites-available have .conf on the end (especially if upgrading from previous Apache and it doesn’t seem to be backwards compatible despite what the Linode library says). Don’t forget to sudo a2ensite all-the-sites.

Drupal 7 notes - making javascript work in a modal

Or more accurately in my case, making a jquery gallery work inside a modal. I am really bad at javascript so I have no idea if my hackjob is a good way to do anything but it did what I wanted. What we needed in a recent project was for a gallery view with a thumbnail slider to launch from a gallery index comprising of thumbnails made up fo the first image in a multiupload image field.

Drupal 7 install profile stuff that everyone else magically knows

Seeing as I found little to nothing when searching for how to configure individual role permissions, editor settings and enabling contrib filters with an install profile, I made something on the off-chance it helps some other poor sap like me who doesn’t automagically know where to look for these things. Enabling filters provided by contrib modules Search in the .module files for _filter_info. Some modules use the same format as Drupal filters of $filters['modulename_filter'], others don’t.

Drupal 7 notes: node or page template by path

Because I always seem to manage to completely forget how to do something this basic. template.php in theme_preprocess_page(&$variables) or theme_preprocess_node(&$variables) <?php $path = drupal_get_path_alias(); if (strpos($path, 'part_of_url') !== false) { $variables['theme_hook_suggestion'] = 'page__whatever'; // or node__whatever if using in a node preprocess } ?> This work is marked with CC0 1.0 Universal

Drupal 7 upgrade from HELL

Modded to be slightly more useful as I wrote the other one while slightly delirious. upgrade to latest D6 drush arb default --destination="wherever/you/like" mysql update systemsetstatus='0' where filename like 'sites%' delete 6.x, retain /files and /sites directories, remember any mods to .htaccess drop in 7.0 files drush updb if no error, press y if error occurs, make a note of what you need to do to fix it. If this is a repeat run, fix all errors noted rename/move your Drupal directory (or delete it but in the event you need it later) from above where the Drupal directory should be, drush arr [backup-filename-without-square-brackets].

Drupal notes: backup process with drush

There’s probably a script for this. Or maybe drush is the script. Is all good, some things are done much faster with commandline :) drush vset maintenance_mode 1 drush cc all drush arb default --destination=../[site]-[date].tar And if there’s updates to be done: drush up -y At the end: drush vset maintenance_mode 0 This work is marked with CC0 1.0 Universal

Sharing is...

…privacy concerning if you’re one of those people that object to things like tracking you around the internet, and not a big deal if you’re not. It bugs me a little bit (especially as I realised recently that I’d forgotten to mention tracking cookies and scripts etc that would have been coming from the share module I was using in my privacy thing) so in the event it bugs anyone who happens to drop by I’ve replaced the module I was using for sharing with [Social Share Privacy](Social Share Privacy).

Drupal 7 notes: html5 placeholder text

Fairly straightforward. Mostly here as a reminder for how to do webforms; (example has a theoretical nid of 1 and a theoretical form field called “message” and the “submitted” part stymied me for a bit). template.php <?php function mytheme_form_webform_client_form_1_alter(&$form, &$form_state, $form_id) { $form['submitted']['message']['#attributes']['placeholder'] = t('Type your message here...'); } ?> Could also use a switch in hook_form_alter(). One of these days I’ll think about finding out if there’s any difference performance-wise in using a big switch with many form alterations or several smaller hook_form_form_id_alters.

theAbysmal Calendar Drupal module

I think it’s done now. fixed an issue where the years weren’t being calculated properly (?!) I may be slightly out of sync with the official documentation, at least according to the tests I’ve done on my local so far. This year should match up, and so will key dates (New Year Day and Leap Day). I’ve shifted leap years to fall on multiples of 4 so calculating would be a simple case of if mod 4 is 0, it’s a leap year, if mod 128 is 0, it’s not a leap year, so some of my years will be a day or two out theabysmal_calendar.

Thoughts on DiSo

I’ve had several. Simultaneously, I’ve had several thoughts on which way this post was going to go. Originally I was going to go along the vein of a blog post from Zauber Paracelsus (which outlines the “nymwars” debacle to the date of that post, people embarking on “Project DeGooglefy” and alternatives to Google services). Then I was going to do something or other about G+ and Facebook and problems with centralised social networks.