Drupal

Browse our site by category or tag.

Drupal

  • Better taxonomy term selection in Drupal- This page on drupal.org shows how to use checkboxes and option boxes instead of the drop-down selectors for taxonomy terms when submitting content.
  • Classified ads module for Drupal 4.7 and Drupal 5 available on Drupal.org- I've committed the classified ads module to the Drupal.org CVS - it's now available for download as an official release package. You can find the official project page (and the official downloads) at http://drupal.org/project/ed_classified.
  • Mollom.com: another spam prevention mechanism for Drupal admins- When trying to keep web site content clean and on-topic, the site administrators often face monumental challenges from spammers. Mollom.com is an alternative to using the Spam or Akismet modules. It's in beta at present, and it is free of charge at present. It is expected to remain free for low-volume users (for details, please refer to the mollom.com web site - link below.)
  • Useful Drupal 4.7 Administrative SQL Queries-

    Quite often, it is necessary to perform batch operations on a drupal-based site - operations on multiple users, or multiple nodes, for example, and the administrative interfaces don't support the desired operation.

    I've put together a list of my favorite queries on this page. I'll update these as time permits.

  • Alexa API module for Drupal- I'm working on an alexa API module that will allow your Drupal-based site to provide embedded Alexa site ranking information. As of now, this module provides a number of useful features:
    • Generate img tag url for Alexa charts - embed Alexa charts in your site pages
    • Query Alexa toolbar data and return it in XML format
    • Caching of queried data
  • Multi-site compatible apache rewrite rules- When using multi-site configurations in Drupal 4.7, and you want to use URL rewriting in .htaccess to force 'www.' or non-'www.' subdomain access, the rewrite rules used in the standard .htaccess file may be problematic.
    # If you want the site to be accessed WITH the www. only, adapt and uncomment the following: # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] # RewriteRule .* http://www.example.com/ [L,R=301] # # If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following: # RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  • Simple classified ads module for Drupal 4.7 and Drupal 5- I've created a simple classified ads module for Drupal 4.7 and Drupal 5. It is now in use on a large number of Drupal-based sites.

    Background

    My classified module creates a new node type ('ed_classified') and associates an expiration timestamp with all nodes of that type. Borrowing from the image.module image gallery scheme, it creates and associates a custom taxonomy with the classified ads. Site administrators then need to create child taxonomy terms for each classified ad category. As with any Drupal taxonomy, ad categories may be nested to arbitrary depth.
  • Drupal 4.7 Site and Database Backups-

    How do I keep my Drupal 4.7 site(s) backed up?

    There are several modules to help you:
    • backup.module Creates an on-demand tarball backup of your database and site files, and downloads them to your browser.
    • Database Administration module Allows interactive backup of database tables (among other things.)
    Another approach is to build a shell script that dumps your database tables and site files into a gzipped tar file on a regular schedule, and set up a unix/linux cron job. (Or, if you are Windows-bound, and have control of the task scheduler and other appropriate permissions, you can schedule a batch file to do the same thing, asssuming all the necessary command line utilities are available to you on the Windows machine. YMMV.)
  • Drupal 4.7 directory module resurrection- I've been granted maintainer status for the orphaned Directory module. (The project page is new; previously there was no project page on drupal.org for this module.) I've checked in a few fixes/improvements - please visit the project home page or the module documentation for the latest information. View fully-functional live demos at: RoadCarvin.com, amadorable.com or bunnytrade.com (all running Drupal 4.7 and latest stable version of this module.)
  • Why can't A Drupal user edit a node they created?-

    Why can't a Drupal user edit a node they created?

    Symptoms: An authorized Drupal user loses "edit" access to nodes they've created, even if they have appropriate node (or other module) access permissions. Or, user cannot edit a node that should be editable by them, based on access control or node access settings. No errors or warnings appear in the Drupal log. Possible Cause: The user does not have permission to use the input filter assigned to the node. (Input filter permissions may have been changed since the node was created. As a result, the user never had, or no longer has permission to use the input filter associated with the node.) This excerpt from Drupal node.module node_access() function tells the tale:
  • Placing "read more" inline with teaser - AngryDonuts.com- This posting on angrydonuts.com (merlinofchaos' excellent site) shows how to customize the placement of the 'read more' link on your site. Most excellent! December 13, 2006 Update I've created a drop-in Drupal module (ed_readmore.module) that implements this handy feature and adds some admin settings to enable/disable, and control placement. Read more about ed_readmore.module.
  • Using Event module with jscalendar (jstools)- When using event.module with JSCalendar (part of jstools module), you might experience problems with event times being stored incorrectly. This appears to be due to an obscure configuration requirement when using JSCalendar - apparently, the event module must be configured to use 12 hour format. (This one bit me in the behind today, so I thought I'd jot this down somewhere...) Be sure to set event.module time notation to 12 hour format: administer >> settings >> event >> "Time Notation Preference" = 12h

    Related info:

    http://drupal.org/node/65125#comment-106269
  • Interesting spammer pattern - how they find sites- Some our our sites that feature free classified ads (amadorable.com, goatseeker.com, and bunnytrade.com) have been hit with a few recurring spammers trying to plant ads for various off-topic products (like cell phones, etc.) I guess this is a good sign; our sites are visible and spammers feel it is worth their time and trouble to post an ad (and no, as far as I can tell, these are not bots - they're human-generated spam.) In reviewing the referrer logs, I've noticed that in nearly every case, spammers use search engines to find sites that have been spammed previously using known keywords - or just sites that offer free classified ads or open posting capability. For example, I find these google searches in my logs, just prior to the spammer creating an account and attempting to deposit the spam content.
  • User notification module- I've been working on a user notifications module (and underlying API module) for Drupal. This is initially needed for for use with my classified ads module but it can be used by any module that needs a well-defined method of alerting users to various events.
  • Insert AdSense Ads Automatically in Drupal Nodes and Teaser Lists-

    Here's a useful Drupal module that tweaks a node's body or teaser to insert an inline AdSense ad, when a node is rendered on a full page or teaser list.

    This allows site administrators to enable automatic insertion of an AdSense ad into the page without the content editor having to insert inline [adense] filter tags, or having to edit a site's template.php (or other template files.) This offers a big advantage, as you can change the ad format, group, and channel on the fly without hand-editing each node (which is the only way I can think of doing it if you are using inline filters). Another advantage is that you can enable/disable the inserted AdSense with just a click of the mouse - no need to edit each node.

  • Drupal adsense_injector.module download (and source code)-

    News flash:

    Now hosted on Drupal.org CVS/Project repository. Please visit the Drupal.org project page for latest releases, bug/issue reports, etc.
    Now hosted on Drupal.org CVS/Project repository. Please visit the Drupal.org project page for latest releases, bug/issue reports, etc.
  • Customize Drupal's 'read more' teaser link placement (Drupal 4.7 or Drupal 5)- Here's a standalone module to provide the customization described at AngryDonuts.com. You can see it in use on this site.
  • User profile spam attack- On Christmas Eve day, several of my sites were 'visited' by what I presume to be a bot, all from the same source IP address. The attack consisted of attempts to register many new user accounts, each having a username containing the term 'DVD': Soccer DVD, DVD Immature, Underworld DVD, Adult DVD, Enigma DVD, DVD shrink, Blues DVD, Trick DVD, Portable DVD Player, DVD Decryptor, Federation DVD The email addresses were all unique of course - since the bot attempted to register multiple user names on each site. The sites were configured to include a text field user profile, so that users can share interests, etc.
  • When DID you load that page?-

    (0 seconds ago)'; ?>

    When I'm viewing Drupal administration pages, like referrer logs or other time-sensitive pages, I like to know the time of the last 'refresh' (and therefore how stale the page content is).

    So, here's a quick and dirty Drupal block definition. (The javascript is not very idiomatic, but it'll do for now until I can update it. In fact, I plan on making it a pure client-side javascript widget, but that's another post for another day.)

    It will display the date and time the page was last loaded, and the 'age' of the page in seconds - it uses a javascript interval timer to update this every second.

    In order to use this on your drupal site, create a new block, paste the code into the block content text field, configure it to use the PHP input filter (so the php code can be interpreted by Drupal), position it in the left sidebar area of your theme (you can place it wherever you wish), and set it to be shown only on admin and admin/* pages.


    Here's the code:

    <div style="float:right; border: red 1px solid;background-color:orange;color:yellow;text-align:center;padding:.5em;">
    <?php
    // todo: make this all client javascript!
    // but, for now, I use the php/Drupal format_date() function to simplify the process of getting a local date/timestamp
    $t = time();
    echo 'Page generated on ' 
       . format_date(time()) 
       .  '  <span style="color:white;"> <br/%gt;(<span  id="page_render_age">0</span> seconds ago)</span>';
    ?>
    </div>
    <script type="text/javascript">
    var page_render_time=new Date().getTime();
    
    function page_render_format_interval(now,start)
    {
       return parseInt((now - start)/1000);
    }
    function page_render_update()
    {
      var now = new Date();
      var et = page_render_format_interval(now.getTime(), page_render_time);
      var elem = document.getElementById('page_render_age');
      if (elem && elem.textContent) elem.textContent = et; // ff/mozilla
      if (elem && elem.innerText) elem.innerText = et; // ie compatibility
    }
    window.setInterval("page_render_update()", 1000);
    
    </script>
    
    

  • MyBlogLog for Drupal 4.7- I've created a simple MyBlogLog module for Drupal 4.7. This module provides the following features:
    • Inserts the MyBlogLog tracking javascript into generated pages - no need to hand-edit your template's page.tpl.php file, or manually create a block to inject the tracking javascript.
    • Provides the "Recent Reader" widget block (includes configuration options - color, width, # rows, etc.)
    • Disable visitor tracking for Administrators and other users on a per-role basis (prevent skewed stats due to admin or other roles' visits.)

    ... and more

  • Help for the weary Drupal developer: api.drupal.org and drupal.org OpenSearch plugins -
    I've created some Drupal-specific OpenSearch plugins for Firefox (and IE7, too!). They provide Drupal.org and api.drupal.org search integration in browsers supporting the OpenSearch search plugin protocol. They are useful when searching for Drupal API routines or other Drupal development subjects. Install them as you would any other OpenSearch plugin...
  • gigs.exodusdev.com now online - uses our Drupal classified ads module- I've set up a new site, http://gigs.exodusdev.com, as a way to showcase my Drupal Classified Ads module. All Drupal consultants or developers are welcome to sign in and create ads for their services. If you are looking for a consultant, there's a category for that, too. I want to put the classified ads module through its paces, so, if you offer or need Drupal services, please drop in at http://gigs.exodusdev.com and give it a try!