Services

  • Drupal CMS Websites
  • Drupal and PHP Developer
  • Custom solutions in PHP/MySQL/jQuery

Welcome

Welcome, I am a Web Developer based in Estepona, Costa del Sol, Spain originally from the UK. I studied Computer Science & eBusiness at Loughborough University. I specialise in Content Management System websites

Will's Scripts & Functions

Below are some of the snippets of code that I have found useful over the years. Most of them are available and better documented on php.net or respective API sites but I have collected together some of the more common ones that I use or took a long time to find.

 

 

Use the filter form below to filter the scripts and snippets by category...

Drupal 6 pay2publish / Pay per Node

I needed a pay per node solution for Drupal, I was very surprised at the distinct lack of modules for this in Drupal! I have started to port the uc_nodetype module for ubercart but have hit some issues. If anyone is interested in helping me with this, then please let me know.

It mostly works quite smoothly, the only problem I have is trying to display the node edit form on the cart checkout page, it either breaks the page or doesn't show any field elements. It should be such an easy thing but I can't figure it out.

Drupal 6 Install schema doesn't create any tables

Basically I was creating a module and it wasn't creating any of the tables I had told it to set up in my .install file, and as far as I can see there weren't any mistakes.

What I found out was that because I had already installed and activated the module once, it wasn't re-running the install file and thus creating the tables.

All you have to do is disable the module AND uninstall the module. You will probably receive an error saying that it can't find the tables to remove but thats fine, thats the problem we are having!

Dynamically read $_POST variables into an array

The code below has been specifically written to take all POST variables and turn them into a string so that they can be used in a URL instead (GET variables)

<?php
foreach ($_POST as $key=>$value)
 
$url .= "&".$key."=" . $value;
?>

Drupal WYSIWYG stops working with my new template

I work on the technical side of Drupal and my colleague works on the design part. At one point in time (without realising when), our WYSIWYG editor stopped working and no others would work in its place. We were using HTMLArea/Xinha but tried the YUI as well as the FCKeditor without any luck.

The strange thing was that the WYSIWYG editor would appear in the blocks edit page but not when creating/editing a page.

Using date popup fields from the date module

I found it hard to find information on how to implement a date field in your forms using the form API. I actually wanted a date popup field. Below is the code for using it

$form['dob'] = array(
  '#type' => 'date_popup',
  '#title' => t('DOB'),
  '#date_format' => 'Y-m-d',
  '#date_year_range' => '-100:+0',
);

You can also find more options here http://drupal.org/node/292667

Drupal 6 Install schema doesn't create any tables

Basically I was creating a module and it wasn't creating any of the tables I had told it to set up in my .install file, and as far as I can see there weren't any mistakes.

What I found out was that because I had already installed and activated the module once, it wasn't re-running the install file and thus creating the tables.

All you have to do is disable the module AND uninstall the module. You will probably receive an error saying that it can't find the tables to remove but thats fine, thats the problem we are having!

Drupal 6 Install schema doesn't create any tables

Basically I was creating a module and it wasn't creating any of the tables I had told it to set up in my .install file, and as far as I can see there weren't any mistakes.

What I found out was that because I had already installed and activated the module once, it wasn't re-running the install file and thus creating the tables.

All you have to do is disable the module AND uninstall the module. You will probably receive an error saying that it can't find the tables to remove but thats fine, thats the problem we are having!

Drupal 6 pay2publish / Pay per Node

I needed a pay per node solution for Drupal, I was very surprised at the distinct lack of modules for this in Drupal! I have started to port the uc_nodetype module for ubercart but have hit some issues. If anyone is interested in helping me with this, then please let me know.

It mostly works quite smoothly, the only problem I have is trying to display the node edit form on the cart checkout page, it either breaks the page or doesn't show any field elements. It should be such an easy thing but I can't figure it out.

Drupal 6 pay2publish / Pay per Node

I needed a pay per node solution for Drupal, I was very surprised at the distinct lack of modules for this in Drupal! I have started to port the uc_nodetype module for ubercart but have hit some issues. If anyone is interested in helping me with this, then please let me know.

It mostly works quite smoothly, the only problem I have is trying to display the node edit form on the cart checkout page, it either breaks the page or doesn't show any field elements. It should be such an easy thing but I can't figure it out.

Drupal 6 Install schema doesn't create any tables

Basically I was creating a module and it wasn't creating any of the tables I had told it to set up in my .install file, and as far as I can see there weren't any mistakes.

What I found out was that because I had already installed and activated the module once, it wasn't re-running the install file and thus creating the tables.

All you have to do is disable the module AND uninstall the module. You will probably receive an error saying that it can't find the tables to remove but thats fine, thats the problem we are having!