Drupal Cron.php not running - aggregator not updating.

Version: Drupal 6.22

For whatever reason Cron will stop working occasionally on a site. The symptoms can vary, in some browsers it loads the custom 404 error page, and in IE it actually went to a white screen but the aggregator data was not being updated. When running cron manually from the Status Report page it simply says cron failed.

Solution:
First run Clear Cache from Admin -> Performance
Edit "common.inc" in the "/includes" directory.
On about line 2721 you need to change;


// Fetch the cron semaphore

Pull values from Drupal User Profile to CCK fields

Surprisingly hard to find, certain snippets floating around on the web do not work for specific versions of CCK. So far these are foolproof with Drupal 6.

global $user;
return array(0=> array('value' => $user->uid));

global $user;
return array(0=> array('value' => $user->name));

global $user;
$account = user_load(array('uid' => $user->uid));
return array(
0 => array('value' => $account->profile_commloc),
);

global $user;
return array(0 => array('value' => $user->mail));

Default Passwords List

A few default device passwords that have come in handy over the years... Drop us a line if you have some to add and we would gladly do so :D

Only show block on specific node type.

There are times where you want to hide Drupal blocks from certain pages but occasionally you want to have them only appear on certain types of content. This can be done with a small block of php code, this example works on Drupal 6, and it has been working great for us on multiple sites.

Take a backup of your site before you start, inserting php code can break stuff.

  • Determine the machine name of your node type (content management -> content types -> machine name is under the "type" column.
  • Create a custom block or edit an existing block

301 Redirect Rule from Clean URL to another clean URL.

If you are trying to setup Clean URLs in Drupal with IIS and Isapi go to Clean URLs IIRF Settings with IIS for Drupal

This seems pretty simple but actually it activated that twitchy angry part of my brain when I tried getting it to work.
Scenario
- IIS Web Hosting
- Drupal 6.0
- Clean URLs working fine
But you want to do a standard 301 redirect for SEO and Google picked up a clean URL that doesn't exist anymore.

Drupal 6 Calendar Setup

Modules Required
Date
Calendar
CCK

Also Recommend
views
jqueryui (for date picker pop-up)

Creating Custom Time format

  • Install modules
  • Administer --> Date & Time
  • Add format tab
  • Custom format string, I like using --> h:ia
  • Back to configure tab
  • Add format type --> Name it --> choose our new custom string

Create new content type

  • New content type called 'event' or whatever you want
  • I change event type title field to "Event Name"

Drupal cck Imagefield Float Right

Drupal CCK Imagefield Float Right

Here is how you can change your css file (likely your style.css file in the theme folder) to have specific cck imagefields float tot he right of your node content.
In this example the machine readable name of the field is "imgfld", this is how the sample image on this page is aligned to the right side using cck.

Add the following to the CSS file of your theme
.field-field-imgfld {
float: right;
margin-left: 1em;
}

Drupal random banner with optional path based image.

We had one customer that required a randomized banner but also had specific drupal pages where they wanted a particular header image to appear. This featured seemed worth the work so I dug into a few of the options out there and came out with a modified solution and minimal code.
This is some php I discovered on adaptive themes as well as the rotate.php that comes with marinelli theme and I have found it in other places as
well.

Clean URLs IIRF Settings with IIS for Drupal

Non-www canonical url using Drupal 6 with IIS and IIRF installed. (Using Drupal 6.22)
Tested and true IIRF settings to remove the www from your URL to make it Google friendly. This also enables you to use clean urls with IIS web servers.

RewriteCond %{HTTP_HOST} ^www.example\.com$
RedirectRule ^/(.*)$ http://example.com/$1 [R=301]

# Accept a url with the following directories and pass them through unchanged.
RewriteRule ^/misc/(.*)$ /misc/$1 [I,L]
RewriteRule ^/files/(.*)$ /files/$1 [I,L]
RewriteRule ^/modules/(.*)$ /modules/$1 [I,L]

Syndicate content