Drupal Dump

Drupal Snippets, Hacks and more....

495 posts since 2011

Setting The Front Page Per Language

This often has given me lots of headaches, how to setup front page for each language. There are several ways, depending on your site configuration chooses one.

Hiding History in User profile view

This option of showing user history seems more obsolite then useful, se lets hide it.

For Drupal 6, copy this file from your /sites/modules/user directory:
user-profile-category.tpl.php, put the copy into your custom theme directory and within that file, replace the code with this

One time login destination override

There is a great module for people you registred manually but you need to give them login information after this. It is one time login module but it lacks option to redirect users to their user edit page, which is the first thing they should do, enter their NEW PASSWORD.

Drupal Calc and age of users

I am bulding a view with stats for users that are registred and inputed DOB. Currently core profile module and views (drupal 6) don't play along when using dates. The way data is stored seems to be the problem. Anyway you can't filter and sort your users by date, but you can make this happen with customfield PHP code.

Code filter fix and help

I was trying to use code filter module for this page, but without any luck. As most users i was getting this error and couldn't do anything to make it work. So I made my own solution for this. I created CSS class

Gmap center and resize when block is collapsed

When you have a problem with google map when hiding or collapsing it within a block you need to do something to fix this. A way to do this is to make gmap block absolute in position and -10000 px in left like

#block-gmap_location-0{
    position: absolute;
   left: -10000px;
}

and then use jquery to show it with js script

Custom field in views, dates ande serializing

When using views, sometimes you just can't get output you want for the fields you are outputing, then you use Custom field module. Custom field let's you use PHP as field and get all the date from other field with $data array (output it with print_r ($data); to see what is in there) So i wanted to output date field with a condition.