Drush command terminated abnormally due to an unrecoverable error


This error might be very frustrating to you, specially when you can't see any issue with your code, can't check error log, and obviously can't do drush watchdog-show. After some search and investigation, found that I had a call to drupal_goto() in an implementation for hook_init() which is implemented on every bootstrap process. The solution … Continue reading Drush command terminated abnormally due to an unrecoverable error

How to test RSYNC before already syncing


Wrong execution of rsync command can result a mess that you may cost you some precious time to fix later, so you can test the rsync command before already executing it using the (-n) parameter or (--dry-run): rsync -anv path/to/file/with/trailing/slash/  path/to/file/without/trailing/slash Then you can execute it by removing the dry run parameter: rsync -av path/to/file/with/trailing/slash/ … Continue reading How to test RSYNC before already syncing

Drupal: Custom node edit menu callback, image upload widget disappears when change file


I had an issue with a custom node edit menu callback, that when the remove button is clicked to replace the current uploaded image, the whole widget disappears. I already loaded node.pages.inc file as follows: module_load_include('inc', 'node', 'node.pages'); BUT, apparently you should add these line to the menu item array: 'file path' => drupal_get_path('module', 'node'), 'file' => 'node.pages.inc', … Continue reading Drupal: Custom node edit menu callback, image upload widget disappears when change file

Show which git branch you are using on terminal


You can Add this code in your ~/.bashrc file to view the current branch in your project like   function parse_git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } RED="\[\033[0;31m\]" YELLOW="\[\033[0;33m\]" GREEN="\[\033[0;32m\]" NO_COLOR="\[\033[0m\]" PS1="$GREEN\u@\h$NO_COLOR:\w$YELLOW\$(parse_git_branch)$NO_COLOR\$ "   Now your terminal will look like the following on a directory that … Continue reading Show which git branch you are using on terminal

Drupal7 Views3: Empty “Row style output” templates


I had an issue when I was trying to create a new display and tried to theme it, I found the "Row style output" template suggestions like the following and with no template content:   Row style output: .tpl.php, --display.tpl.php, --type.tpl.php, ...   After some investigation, I found that the reason that caused this that my … Continue reading Drupal7 Views3: Empty “Row style output” templates

WordPress: WooCommerce: Add a custom currency / symbol


To add a custom currency paste this code in your theme functions.php file or in a complementary plugin for WooCommerce and swap out the currency code and symbol with your own. After doing so it will be available from WooCommerce settings. add_filter( 'woocommerce_currencies', 'add_my_currency' ); function add_my_currency( $currencies ) { $currencies['ABC'] = __( 'Currency name', 'woocommerce' ); return … Continue reading WordPress: WooCommerce: Add a custom currency / symbol