Submitted by dmytro on Fri, 03/09/2012 - 10:03
Hi! Today I'll show you how to submit a comment programmatically. As always I'll show you the most important part of working code.
Submitted by dmytro on Wed, 03/07/2012 - 22:01
I was working on a project where we have to import a lot of user pictures programmatically. Hopefully, Drupal is a great tool! Today I'll show you how to add a picture to the user account programmatically.
Submitted by dmytro on Wed, 03/07/2012 - 21:38
node_save($node) is not only the way to save a node programmatically in Drupal. node_save() doesn't fire all the necessary hooks after a node creation. This is a problem. In D6 we used drupal_execute() to emulate a real user node submission. But what in D7? drupal_form_submit() is the same thing in D7.
Submitted by dmytro on Fri, 02/03/2012 - 07:51
Hello! Today I'll tell you how to place views template files in your custom module's directory. It's easy to override views template within theme, but to achieve our goal we need write some code. We will override template for Views Row style output. Please, search views-view-fields.tpl.php file in views module directory.
Submitted by dmytro on Tue, 01/03/2012 - 16:21
Module Builder is module which auto-generates a skeleton or "scaffolding" for a module, along with hints on how to fill them in. Useful for newbie developers to learn how hooks work, and seasoned developers who are too lazy to look up what arguments a function has to take. ;)
Submitted by dmytro on Sat, 12/17/2011 - 07:07
Imagine you are developing custom module or feature which makes some changes to the database and files tree during the installation process. Sometimes testing you code can be painful. Every time to test your code once again you must revert database and files tree to previous state. This operation is not quick. Not rarely you have to repeat it a lot of times. Here I'll propose my way to solve this problem.
Submitted by dmytro on Mon, 12/05/2011 - 18:16
Drush is a really great tool! It provides two very useful commands to perform backup and restore operations on Drupal sites. Previously we had to create and restore sql dump and files tarball manually. With new Drush it's really easy.
Please check you Drush version. This text was written for Drush 4.5.
$ drush --version
drush version 4.5
The simplest way to make backup is to run Drush command inside drupal root.
$ cd /var/www/example.com
$ drush archive-dump --destination=/var/backup/example.com.tar.gz
Archive saved to /var/backup/example.com.tar.gz [ok]