Drupal Blog

Post date: Thu, 05/09/2013 - 18:19 Views: 112 Comments: Comments
Tagged under: Drush

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...

Post date: Tue, 04/23/2013 - 20:12 Views: 180 Comments: Comments
Tagged under: Drupal 7 | drupal quick tips

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:

<?php kpr(get_defined_vars()); ?>

Alternatively, a print_r should work just fine:

<?php print_r(get_defined_vars()); ?>

More info: http://php.net/manual/en/function.get-defined-...

Post date: Thu, 02/28/2013 - 14:55 Views: 421 Comments: Comments
Tagged under: Drupal 7 | drupal quick tips

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. 

Post date: Mon, 09/10/2012 - 21:30 Views: 14,784 Comments: Comments
Tagged under: Drupal 7 | drupal quick tips

The code below goes in your template.php and removes the "More information about formatting options" link.


<?php
/**
 * Remove the comment filters' tips
 */
function MyThemeName_filter_tips($tips, $long = FALSE, $extra = '') {
  return '';
}
/**
 * Remove the comment filter's more information tips link
 */
function MyThemeName_filter_tips_more_info () {
  return '';
}
?>

Please remember to clear the cache in order for the changes to trigger.

Post date: Tue, 09/04/2012 - 09:20 Views: 1,648 Comments: Comments
Tagged under: Drupal 7

I recently had the requirement to hide a horizontal tab in node display depending on the value of a checkbox i.e. Show tab X. For the horizontal tabs I was using the excellent Fieldgroup module.

In order to achieve the above, I created a little custom module and used the newly introduced in drupal 7 hook, hook_node_view_alter.

Syndicate content