Drupal 7: Heartbeat comment messages show up twice!

· konordo
Heartbeat messages were showing up nicely on a project we have been working on lately, bringing up all the member activities including changing the user account details, adding or editing nodes and commenting on nodes. Everything was working fine right out of the box - except one minor inconvenience that we noticed: all comments were showing up twice in the heartbeat stream. As many love to say, this is not a bug, it is a feature.

Configuring drupal cron jobs in crontab.

· Anonymous (not verified)

Drupal 7 has the ability to run cron automatically, but if there are tasks that really depend on cron, it only makes sense to ensure that cron is running in pre-defined time spans.

To make sure of that, we can configure the drupal cron to run from a server side command. So from the console, In crontab, the following line will trigger Drupal's cron

Drupal Commerce - Translate Order total, Shipping Information, Billing information

· konordo

If you do not want to use i18n_string and i18n_field in order to translate the Order total, Shipping & Billing Information texts, that show up in the cart and on the checkout pages when using Drupal Commerce, the following hacky approach should do the trick.

First, the following funcion can be used in your template.php file:

Drush - Short Tips

· konordo
Quick notes on Drush, while on a Drupal installation folder: To create an archive of the current Drupal site: drush archive-dump --destination=/backups/mysite.tar To restore the files and databases for all sites in the archive. drush archive-restore /backups/mysite.tar To create a mysql dump of the current Drupal database: drush sql-dump --result-file= /mydb.sql To drop all tables of the current Drupal database: drush sql-drop To import a new db file in the current Drupal database:

Drupal 7: How to check the available variables in a template (tpl) file

· konordo
There is a very handy php function that allows us to quickly check all the available variables in a tpl file (e.g. html.tpl.php). Assuming that the devel module is installed, the following line should do the trick: Alternatively, a print_r should work just fine: More info: http://php.net/manual/en/function.get-defined-vars.php

Drupal 7: Reset User 1 Password quick and easy using Drush

· konordo

There are many solutions out there to reset User 1's password in a Drupal 7 website. A really convenient way is to use Drush, to generate a one time login URL - no mails involved. The output would be directly on the console, and it is simple to just copy and paste it in a browser. 

The drush command is the following:

 

drush php-eval 'echo user_pass_reset_url(user_load(1));

 

and once logged in, the password can be easily changed in the user edit screen.