Removing a link from Webform block

If you display your webform as block and then also use Full Node view in block settings, you will have a title that leads to the webform itself. Probably you don't want to do that. But what to override, it's kind of simple, just override node--node_id.tpl.php as this is in the end a node display and remove link from h2 tag. That is all.

Theming Ubercart Order Admin or uc_order-admin.tpl.php

So this one is rather old in 2013. But then again Ubercart and E-commerce are slowly getting up to speed with drupal 7 so still many sites use Drupal 6 for web shops. Anyhow, what we wanted to do is add some extra information to emails sent after order. Ubercart has a way of sending nice HTML emails to clients and obscure plain text emails to admins. Which is ok by me and in drupal 7 it is easily replaced and set up by additional email modules like MailSystem I think https://drupal.org/project/mailsystem which integrates with UberCart in drupal 7.

Setting a drupal 7 Multisite to localhost

Without a powerful server drupal administration online is very slow. As I have a multisite online, for some bigger changes I decided to take it offline to localhost and try to build/change things on my computer an then upload DB online. But first I needed to configure my localhost to work with multisite. Procedure is similar as on VPS with LAMP (having WAMP locally) but you need to change some different files.

So first thing you need to do is enable this possibility with

Enable Virtual Host

Webform mail template override - total customization

I wanted to make a override of webform mail template, so I can send custom data to paying and non paying partners on my site. As I am using ZEN subtheme, I need to put all the the template in obviously template folder of subtheme, not a root one. Find a default template file in webform module webform-mail.tpl.php and make it something like webform-mail-174.tpl.php, 174 being a nid of your webform. So in order to make this override work. You also need to choose carefully in your webform UI.

PHP block visibilty

To set block visibilty with fine details in drupal 7, you need to install php filter which is part of drupal core but not enabled by default. And then off to write some code. First part of code uses node type to show, in this case hide block for particular content type and in the second, we check url argument, so we hide if for particaler views.

<?php
$return = TRUE;
if ( (arg(0) == 'node') && is_numeric(arg(1)) ) {
$nid = arg(1);
$node = node_load($nid);
$type = $node->type;
if($type == "dentist") {

How to remove 'all' contextual filter that is added by default to breadcrumb

In views there is that part in contextual filters where you can set exception and it is by default set to "all" so if you want to show all the nodes which in a way disables this filter, you can use that. But it also adds itself to default bredcrumbs of your drupal installation. So to remove it from breadcrumb, just use "show page not found" for the "When the filter value is not in the URL:" and this removes it at least from breadcrumbs, but it is still in the system.

Re-ordering Webform Component Descriptions

Webform is great but fails sometimes at some basic things. Like you want to display description before the field, YOU CAN'T!! seems stupid but it is like that. You can do some nasty jquery overrides or CSS if you can (put both as absolute position and move them). But to do this "DRUPAL WAY" you need to make a custom preprocess function for this in your theme. There is many debate about this in drupal community and we have a similar solution, a bit more smarter though as you can move description just for the field(s) you want.

You should add this function to template.php

Adding unity to flash node module

In drupal 6, there is a very nice module for flash content. Called Flash node http://drupal.org/project/flashnode which does everything you need for flash files swf (not flv or mp3, you need swf tools for that). But as I have games site I wanted to add unity files to my nodes. As unity files are integrated very similar to flash, just different object values in html. I just hacked flash node and add one If to check if file is .unity3d and then if it is, just construct the object and embed tags differently and you have a unity node aswell.

Taxonomy Autotagger and url aliases

There is a great module for auto tagging nodes with tags/terms for drupal 6, hopefully something similar will be for drupal 7 aswell http://drupal.org/project/autotag

Problem with this modules is that it doesn't respect(check) pathauto setting for URL (which is non existant, more here http://drupal.org/node/1167612) so you will have lots of new URLS if your pathauto settings has changed since the first node and you have old nodes with different path aliases. So to respect this go to autotag.settings.inc and edit function _autotag_mass_update_helper($nid) so that you add

Drupal 7 imagecache, theming images in templates

Creating images in your templates in drupal 7 is somewhat different, so here is the code

<?php
$hero_image = array(
'style_name' => 'case_study_teaser',
'path' => $image['uri'],
'width' => '',
'height' => '',
'alt' => $image['alt'],
'title' => $image['title'],
);
print theme('image_style',$hero_image);

$img_url = 'public://myimagefolder/imgfilename.jpg'; // the orig image uri
$style = 'thumbnail'; // or any other custom image style you've created via /admin/config/media/image-styles
?>