The U.S. holiday of April Fools' Day fast approaches, and I wanted to play a joke on one of my site builders in our dev environment. My first instinct was to modify template.php to flip all the site images upside-down.
The code below works fine if you're somewhat technical and know the user IDs of the people on whom you want to play a joke. Then I realized it would be fun to release this to the community, so I considered creating my own module.
*Then* I realized that Misery already acts in much the same way, and I could lightly modify the module for my purposes. I created this issue to:
- Share some fun with the community; and
- As a learning exercise, attempt to help with any bugs I encounter in the Misery module.
I'll post my patch in a minute.
/*
* Implements hook_html_head_alter
*/
function NameOfMyTheme_html_head_alter(&$head_elements) {
// Modify the user IDs below to suit.
global $user;
if ($user->uid == 1 || $user->uid == 2 || $user->uid == 3) {
drupal_add_css('img {-moz-transform: scaleY(-1); -webkit-transform: scaleY(-1); -o-transform: scaleY(-1); transform: scaleY(-1); -ms-filter: flipv; /*IE*/ filter: flipv; /*IE*/ }', array('group' => CSS_THEME, 'type' => 'inline'));
}
}
From:
http://adaptivethemes.com/how-to-add-css-files-in-drupal-7
http://stackoverflow.com/questions/1309055/cross-browser-way-to-flip-htm...
Based on:
http://xkcd.com/341/
http://www.ex-parrot.com/pete/upside-down-ternet.html
-John
Comment | File | Size | Author |
---|---|---|---|
#1 | misery-crazy_screen_for_april_fools-1950286-2.patch | 2.45 KB | jtherkel |
Comments
Comment #1
jtherkel CreditAttribution: jtherkel commentedSee attached for the patch. Known issues:
1) This will not work if you're trying to play a joke on a user who has the ability to administer the Misery module.
2) This patch removes a bug identified in Parameter 3 to misery_misery_perform() expected to be a reference, but it also removes some functionality. I'll update the April Fools' patch if that issue receives an update.
To address #1 above, change line 281 in the .module to: