Main menu

How To: Implement Start and End date fields using regular Drupal 7 Form API

Published by dnovikov on Fri, 10/03/2014 - 15:51

Drupal Date module allows creation of so called "combo" fields in content types, which means you get a combo of "Start date" and "End  date" fields. But what if you want to implement this behavior in your arbitrary form? Well, create two normal "date_popup" fields:


How to: Integrate Youtube IFrame API and Youtube field in Drupal 7

Published by dnovikov on Wed, 09/03/2014 - 12:20

If you are using Youtube module to display videos at your site, you may want to add some reactions on the Youtube player events. For instance, I did so for Google Analytics tracking capabilities.

To enable usage of the Youtube IFrame API, you need to add some Javascript code. Please remember: do not put it in Drupal behaviors wrapper!

The code is like this:

// Load YouTube IFrame API.
var tag = document.createElement('script');

Password Bcrypt module

Published by dnovikov on Thu, 08/14/2014 - 11:20

Recently I've met with very strict security requirements from one of big companies. Particularily, they wanted another password encryption scheme to be implemented at their Drupal 7 site. It is not very difficult to do, but needs some accuracy and correct flow design. OAuth Library

Published by dnovikov on Mon, 02/10/2014 - 17:43

SmartWolverine just released an OAuth library for authenticating OAuth services. Check it out at Github: and Packagist:

It is also mentioned among official Iron.Io libraries at

PHP serialization and line ending problem

Published by dnovikov on Tue, 12/17/2013 - 14:04

When you serialize data containing text strings which have mixed line endings ("\n" and "\r\n"), unserialization often does not work. This bug is described at

To fix the issue use json_encode around serialized string:

$data_serialized = json_encode(serialize($data));

JSON format expects explicit line ending characters displayed as user readable text in form of "\n" and "\r\n".

After that decode string back and unserialize it:

MySQL - Get a list of table columns separated by comma

Published by dnovikov on Tue, 11/12/2013 - 08:56

In every MVC framework sometimes you need to create a list of MySQL table columns in order to use them in your model. You can simply copy-paste them from phpMyAdmin one by one. But once I needed to create several models at a time. Here is a simply query which lists all columns in a basic format, which can be used in PHP code later.

At first do USE information_schema, or switch to this database in your GUI tool.

The actual query is

Drupal 6 - FCKEditor 2.6.5 does not show up after Chrome update

Published by dnovikov on Tue, 10/15/2013 - 14:40

For those who experience issues with some sites, using old Drupal FCKEditor module (line 36 of fckeditorcode_gecko.js, Javascript library version 2.6.5) after a Chrome update - here is a patch which hopefully fixes the issue (like it did for me). At least you can look into it and see the reason of the issue.

This issue is related to this one in the Chrome issue tracker:

Popup On Load tutorial - Part 1

Published by dnovikov on Wed, 09/25/2013 - 18:36

About a month ago I released a module called "Popup On Load". Its main features are listed at Here I want to satisfy community request at, and write a short instruction of how the module can be configured and used.

Drupal 7 - Popup On Load

Published by dnovikov on Fri, 08/16/2013 - 18:39

Proudly announcing: Popup On Load module!

Main features:


FuelPHP - Nested queries using query builder

Published by dnovikov on Thu, 05/30/2013 - 10:16

Once I've needed to do a "WHERE IN (SELECT * ...) filter in my query. The intention was to use FuelPHP's query builder. After some googling, which gave no results, I've started some dumb experiements in code. Here is what I achieved, the solution seems to work perfect: