Joomla, Mysql, Symfony, Drupal, Code Samples, PHP

Create tokens for profile fields Drupal 6

by John McGeechan

Synopsis


 How to add profile fields to the token logic

 

 

Overview

Two hooks are required..

  • hook_token_list to add fields to the list of available tokens
  • hook_token_values to provide the values for those fields

 

Here's some code I prepared earlier....

 

Drupal cache_get - why it doesn't always give you what you expect

by John McGeechan

Drupal cache_get - a gotcha


Background

Noticed that cache_get did not seem to obey the cache lifetime, returning 'expired' cache data

Overview

After over-abusing the drupal cache tables, to store any and every bit of custom cached data, using the default 'cache' table, I decided to roll my own

Views AJAX problems

by John McGeechan

Overview

Recently had the ajax functionality in views admin suddenly start  throwing errors...

An error occured at /admin/build/views/ajax/config_item/....


This error extended to most ajax operations with views admin and meant that none of the ajax functionality would work

How to give any youtube video a thumbnail of your choice

by John McGeechan

overview

Anyone who has loaded up a video on youtube had faced the frustration of being forced to use a choice of one of 3 random images. Youtube seems to have a maniacal obsession with not allowing users to specify their own chosen thumbnail for a video - there may be a good reason for this btw, I just don't know what that reason is. You can specify the thumbnail if you are a youtube partner, but as of the publication of this article (2013-07-18) it certainly isn't the case for a regular youtube account.

Drupal and mollom

by John McGeechan

Drupal and mollom - or why users may not be able to register on your site and you would never know it


Background

We currently run drupal on a single code base over multiple domains (via domain module suite). Just recently we had reports that some users could not register on some of the domains as they could not answer the Mollom captcha correctly

Using drupal and SVN for module updates - best practice ?

by John McGeechan

Synopsis


 One way to release module updates using drupal and subversion

Canonical meta tags for drupal multiple domain sites

by John McGeechan

Synopsis

 Slight enhancement to domain_source module to add canonical meta tags to node. Canonical meta tags can improve SEO

Easily Define preprocess functions by content type in Drupal

by John McGeechan

Synopsis


A shorthand way to provide preprocess "hooks" for any content type.



This snippet can be placed in a template or your chosen module, I usually place this in both the node and page preprocess function eg

Drupal plugin written in Jquery to increase or decrease web elements or font sizes

by John McGeechan

Synopsis

 A handy little Drupal plugin that let's users increase/decrease fonts with a single click

nb I tried  the official drupalfont  resizer, but could not get it working, on the off-chance that you have the same problem...