You are hereModules
Modules
Getting host node and node id of field collection
I was killing myself to get host node and node.id of field_collection I am using so I can do some preprocessing before this node is saved. I was trying with field_collection_item_get_host_entity but just couldn't make it work. So I asked google and found out I can do it with regular host function like
$node = $collection->hostEntity();
echo $node->nid;
Module paths in DB
Working with multi sites and modules located in sites/all and sites/some_site your module paths could get in problems. So for a fix check you just need to replace paths in your DB like
and this way all your contrib modules get new path, set for the sites/some_site location. You should do this when you move your modules which are already in system and you have errors and problems with paths shown.
Drupal missing modules and white screen of death
WSOD (white screen of death) can happen in drupal for different reasons. One is that you could be missing some files, probably modules. Maybe you moved something wrong when migrating, or you have wrong git branch or just delete module(s). Anyway when module is missing drupal will try to find it like crayze For example: 1 missing module lead to 900 file_scan_directory() calls resulting in a wasted 250ms every page load it is said here
Add UTM tag to links, so other people know when users come from your site
So this is some marketing stuff I do, but it is useful. When you click a link on some site, to give some message to that site and owner or whoevere is taking care of marketing you can add some UTM tags to links so in their google analytics they see that message. So what do we do is I use display suite, create custom code field and use entity data to make new fields that look like this:
if (!empty($entity->field_collegamento)){
foreach ($entity->field_collegamento['und'] as $key => $value) {
Adding tracking (google analytics event) to phone numbers/phone calls
I wanted to have phone call tracking on my website, so I know how many users did click phone number to call over cell phone or phablet or whatever device they can call (maybe google glass or something) So I added some code to my phone fields. I have cck field that I display over display suite, so I override this field and remove default display and create custom display, code field where I use entity data and add custom code to the phone numbers so they are clickable links. Code looks like this
if (!empty($entity->field_phone)){
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
Mass enable/disable comments
If you created nodes and then enabled comments module after that you will have all those nodes without comments. Even if you enable comments for that content type, this will only help on the new nodes created. So to do that you would probably either run some code in phpmyadmin or make action to use with VBO module.
So for drupal 6 we go to phpmyadmin and run this query
and for drupal 7 you need to set it also in node_revision table so it is a bit more complex
Microdata and Fivestar
Microformats are going to be big, they are big even today. Drupal is caching up but modules don't work properly. First thing you would probably do is ratings/review formating. You can try with microformat and fivestar module but it will not work properly. So I themed the fivestar summary function differently and added few lines and not it works and you can check it with google tool
http://www.google.com/webmasters/tools/richsnippets
Just copy this to your template.php or use some diff tool to see what is different
http://www.quickdiff.com/