Planet Drupalhttp://bleen.net/
enMon, 23 Jan 2017 12:48:44 -0500Fri, 21 Apr 2017 12:48:55 -0400Rerunning update hooks in D8http://bleen.net/blog/rerunning-update-hooks-d8
<p>Note: there be dragons here... read all the way through before trying this.</p>
<p>When I'm writing an update_hook for a module I'm working on I often need to run it multiple times in order to get it working just right. In Drupal 7 I had a little trick where I would run my updates and then reset the schema version of my module directly in the database and then run my updates again. I'd rinse and repeat until everything worked as desired.</p>bleen45 at http://bleen.net2017-01-23T12:48:44-05:00Planet DrupalSmarter Image Cropping - Focal Pointhttp://bleen.net/blog/smarter-image-cropping-focal-point
<p>Automatically scaling and cropping images can save you tons of time when you are uploading images to your site. The problem is that, by default, Drupal gives you very limited control over what to crop:</p>
<p><img alt="" height="365" src="/sites/default/files/field/image/crop-effect.png" width="450" /></p>bleenhttp://bleen.net/blog/smarter-image-cropping-focal-point#comments44 at http://bleen.net2014-02-18T09:30:00-05:00Planet DrupalC'mon Drupal: Make Displaying Images Easier with Representative Imagehttp://bleen.net/blog/cmon-drupal-make-displaying-images-easier-representative-image
<p>Sometimes Drupal makes me bang my head on the desk. It can perform all these incredibly complex tasks and support countless technologies but occasionally it's the simple problem that flumuxes it. For a long time I've been banging my head against just such a problem: lets say I want to create a list of content containing different types of content each with an image.</p>bleen43 at http://bleen.net2013-05-20T16:36:43-04:00Planet DrupalRunning Batch Processes in an Update Hook... in Bedhttp://bleen.net/blog/running-batch-processes-update-hook-bed
<p>Sometimes you have to do a whole lot of stuff during an update. Sure you could just write a standard <a href="http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_update_N/7">hook_update_n() function</a> and try processing 50,000 nodes but if you do you're almost guaranteed to run out of memory or timeout or generally make your web servers unhappy. Luckily you can use <a href="http://drupal.org/node/180528">Drupal's batch API</a> within your update hook.</p>bleenhttp://bleen.net/blog/running-batch-processes-update-hook-bed#comments42 at http://bleen.net2013-01-24T03:00:00-05:00Planet DrupalDo Websites Go On Vacation?http://bleen.net/blog/do-websites-go-vacation
<p>It's well known that websites have traffic patterns and that there are those times of the day/week/month/year were traffic predictably increases or decreases. Just like the 405 in LA, or the LIE in New York, or the 75/85 connector in Atlanta, traffic is likely to be pretty light at 2:00am on a Sunday, but travel those same roads 30 hours later and, well, bring a book...</p>bleenhttp://bleen.net/blog/do-websites-go-vacation#comments41 at http://bleen.net2013-01-14T05:30:00-05:00Planet DrupalAdvertising & Responsive Web Designhttp://bleen.net/blog/advertising-responsive-web-design
<p>So you've jumped on the responsive design bandwagon? Good for you. You've spent weeks coming up with an awesome content strategy for your site and you've spent countless iterations perfecting your users' experience across devices with different screen sizes and less-than-awesome download speeds. You've even taken <a href="http://fremycompany.com/BG/2012/Ambient-light-sensors-and-CSS-Media-Queries-971/">ambient light</a> into consideration (who knew?).</p>bleenhttp://bleen.net/blog/advertising-responsive-web-design#comments40 at http://bleen.net2012-12-02T14:30:40-05:00Planet DrupalHacking Core & Contrib Responsiblyhttp://bleen.net/blog/hacking-core-contrib-responsibly
<p>By now we have all (hopefully) heard the Drupal mantra "Don't hack core!" Usually this statement is followed by a quip about killing kittens and then a long (and necessary) diatribe about how hacking core makes it more difficult to maintain your site; leads to unexpected behaviors; and makes debugging issues ...um... adventurous. These things are all true. Very, very true.</p>bleenhttp://bleen.net/blog/hacking-core-contrib-responsibly#comments39 at http://bleen.net2012-10-07T23:48:46-04:00Planet DrupalMaintaining different settings on different environments with Drushhttp://bleen.net/blog/maintaining-different-settings-different-environments-drush
<p>On nearly every site I have ever worked on there has been one or two settings that I wanted set differently on dev as compared to prod. Of course I could just set the settings locally, however every time I would bring the production database down those settings would be overridden. For example I always want to have the <a href="http://drupal.org/project/devel">devel</a> module enabled locallay to —ya know— help me devel, but I amost never want it enabled on production. To solve this problem I've written a simple Drush command called "environmnet." Here's how it works…</p>bleenhttp://bleen.net/blog/maintaining-different-settings-different-environments-drush#comments38 at http://bleen.net2012-07-22T12:34:26-04:00Planet DrupalApplying a Patch from drupal.org in 2 Seconds or Lesshttp://bleen.net/blog/applying-patch-drupalorg-2-seconds-or-less
<p>I used to apply patches from drupal.org by goeing to the issue page where the patch has been posted, downloading the patch to my desktop (or wherever) and then applying it using <code>git apply /path/to/file.patch</code>. Today I figured out a better way.</p>
<p>Open your favorite terminal application <cough>iterm2</cough> and cd to the git repository to which you want to apply the patch. Then type</p>
bleenhttp://bleen.net/blog/applying-patch-drupalorg-2-seconds-or-less#comments37 at http://bleen.net2012-05-06T21:43:31-04:00Planet DrupalDoubleclick for Publishers & Drupalhttp://bleen.net/blog/doubleclick-publishers-drupal
<p>What do Google's Doubleclick for Publishers (aka DFP) and Drupal have in common? They each have a zillion different ways to set things up. Read on to see a walkthrough of how you might configure everything to get your display ads going using the <a href="http://drupal.org/project/dfp">DFP module</a>.</p>
bleenhttp://bleen.net/blog/doubleclick-publishers-drupal#comments36 at http://bleen.net2012-03-31T14:50:15-04:00Planet DrupalAn easier way to add contextual links in Drupal 7http://bleen.net/blog/easier-way-add-contextual-links-drupal-7
<p>Contextual links are a great new feature of Drupal 7. Basically, links are added to various elements of the page to make it easy for site editers to make changes to whatever content they currently see.</p>
<p><img alt="" src="http://bleen.net/sites/default/files/field/image/contextual_links_0.png" title="" /></p>bleenhttp://bleen.net/blog/easier-way-add-contextual-links-drupal-7#comments35 at http://bleen.net2011-10-16T13:09:33-04:00Planet DrupalSpeedup Drupal 6 ... turn off Update Statushttp://bleen.net/blog/speedup-drupal-6-turn-update-status
<p>It turns out that the Update module that comes with Drupal runs some pretty hefty queries. While trying to debug a crazy mysql error we were seeing on one of the sites I work on (<a href="http://drupal.org/node/361563">http://drupal.org/node/361563</a>) it occured to me that there is no reason why we should have the update module enabled on our production site at all.</p>
<p>Turning it off on production (while leaving it on on staging) gave the site a nice litte pick-me-up especially after clearing the cache.</p>
bleenhttp://bleen.net/blog/speedup-drupal-6-turn-update-status#comments34 at http://bleen.net2011-04-21T11:08:36-04:00Planet DrupalDebugging Memory Problems During Cron Runhttp://bleen.net/blog/debugging-memory-problems-during-cron-run
<p>Recently my cron stopped running completely and when I would manually visit mysite.com/cron.php I'd get a message like this:</p>
<pre class="brush:plain">
Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in ...</pre><p>So how do I debug this? I went to module.inc then added a bit of code to <code>module_invoke_all();</code></p>bleen33 at http://bleen.net2010-11-01T14:20:49-04:00Planet DrupalDrupal & Dropbox: An Improved Workflowhttp://bleen.net/blog/drupal-dropbox-improved-workflow
<p>I develop my sites on two different machines; constantly SVN committing and SVN upping just to keep files in sync between the two. And worse, I'm forever doing mysqldumps to keep my local databases up to date.</p>
<p>And then it dawned on me...</p>bleen32 at http://bleen.net2010-10-08T11:47:09-04:00Planet DrupalCustomizing Drupal Forms: What I just learnedhttp://bleen.net/blog/customizing-drupal-forms-what-i-just-learned
<p>I've been working on a project that required some pretty heavy-duty customizations to how the user registration form looks and while getting everything to work I learned a few things that have changed the way I look at customizing forms in Drupal. Here is a quick summary of what I already new, and what I know now.</p>bleen30 at http://bleen.net2010-09-01T10:04:01-04:00Planet Drupal