Drupal Dump

Drupal Snippets, Hacks and more....

495 posts since 2011

Simple google map

You want simple google map without some extra modules, API keys etc? This is rather simple, all you need is to go to google maps, choose your location and go to upper right corner where is "Paste HTML to embed in website" code, copy that code. Go to Block sections in your drupal administration, create new block and place that code in block.

Custom imagecache output of image

You are looping through some arrays and you have some image variable, path of original image. You want to print out some variation of that image, this is what you do

Get and loop results from view

You constructed a view and want to get view results and fine tune some usage of them by PHP this is how you get them

 $view = views_get_view_result('Name_of_View'); print_r($view);  

You will get classic array of values where you can choose which one you want to use and print out. You can also add name of display you want to use.

Profil to Content Profile

There is a content profile module that basicly uses standard nodes for user profile data. When will you want to use it? When normal profile resources run out. This is usually when you want to have a more complex fields for user or have some backreferences.

User Import patched with Date import working

Importing dates like date of birth dosen't work with User import module. There is a clever patch with UI options for setting it up under user import configuration that can be found here but for users that want that patched already applied we provide it down below for download.

User import/Node Import, UTF characters and Excel

Many have encountered this unicode/utf encoding problems in their programming life. It is just a drag to make it right and without knowing all the stuff around it and understanding it you will have bugs and problems. You will usually import data to drupal with CSV files. It's fine until you start using non english alphabet.

User import Delimiter

If using user import module for drupal you could run into problems of delimiters. By default it uses comma and not much better solution which is semicolon, here is a patched filed that has constant on top if you want to change it manually