Services

  • Drupal CMS Developer
  • Website speed optimisation
  • Drupal 6 to Drupal 8 migrations

Welcome

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

Drupal

Drupal 6 override theme for a page in a module

This is actually quite simple. Lets say you want to override the admin theme only when creating a new node of type TYPEX

Drupal - completely render another node including hooks

If you need to completely load another node in a module which includes the content element of the node object then use the following code...

<?php
$node
= node_load($nid);
$node->build_mode = 'full node';
$node = node_build_content($node);
drupal_render($node->content);
content_alter($node);
?>

Just replace $nid with your node id that you want to render and your $node is ready to go.

Pasat 4b Payment Method (uc_pasat4b) setup instructions

I was receiving errors from the bank system after having installed the uc_pasat4b module - http://www.ubercart.org/project/uc_pasat4b. After having used the sermepa system for every other website I have built, I was totally confused as to why it wasn't working and why the module wasn't sending all the data that I thought it should be.

Remove "not verified" from comments

Just insert the following code into your template.php in your theme...

<?php
function phptemplate_username($object) {

if ($object->uid && $object->name) {
// Shorten the name when it is too long or it will break many tables.
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) .'...';
}
else {
$name = $object->name;
}

if (user_access('access user profiles')) {
$output = l($name, 'user/'. $object->uid, array('title' => t('View user profile.')));
}
else {
$output = check_plain($name);

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

Place a link to a view page next to the node edit link

I was trying place a link to a views page in the tabs that appear on nodes, I wanted it to appear link "Node Edit MyNewLink". The way to do this is to set the page URL "node/%/MyNewView", and create a normal "menu tab". The link will automatically appear, just make sure you replace "MyNewView" in your view path to something relevant.

Display signature in User profile page

I was really surprised that Drupal as standard did not show the user signature on the user profile, it doesn't even give you the option! It's really simple to do if you know how but took me a while to figure out.

You must create a module (see drupal documentation for doing that) and paste the following in...

function MYMODULE-NAME_profile_alter(&$account) {
$account->content['summary']['signature'] = array (
'#type' => user_profile_item,
'#title' => t('About the writer'),
'#value' => $account->signature,
'#weight' => -1,
);
}

Drupal Views2 - Display all values if no results with exposed filter

I had an issue where I had a google map showing the locations of results, and a filter which helped you zoom in on locations. Basically you typed a location and the map showed the location of the results as well as some listings. However, if there were no results, instead of showing an empty page, I wanted the google map to appear with all results and an error message. What I did was set up an "Empty text" value which called a views function "views_embed_view()", I then created a block within that view but without the exposed filter (actually removing that filter all together).

Views 2 - Don't list / Exclude current page

If you want to create any normal listing based on category or content type and say have it appear in a block across several pages, but want to make sure that the page you are currently on doesn't appear in the list, then the below should help
Instructions made from a collection of information found in Drupal website...

1). Open up your view
2). Create an argument of Node > Node id.
3). Then choose the radio button option of "Provide default argument"

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.

Syndicate content