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

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

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

WordPress: WooCommerce plugin: How to Override WooCommerce Template File Within a Plugin


Override WooCommerce Template File Within a Plugin The goal of this article is to describe one approach to overriding WooCommerce core template files within a custom plugin, such that they can still beoverridden by a theme in the typical way. Note that this is similar to but solves a slightly different problem than what we did to create a custom … Continue reading WordPress: WooCommerce plugin: How to Override WooCommerce Template File Within a Plugin

PHP – Ubuntu: supported locales


1. First of all list supported locales: cat /usr/share/i18n/SUPPORTED 2. Copy the locales for your region. I will copy the following lines: sv_SE.UTF-8 UTF-8 sv_SE ISO-8859-1 3. Edit the list of 'supported locales' and paste your locales that you've copied. (See step above) gedit /var/lib/locales/supported.d/local   4. Finely generate your locales dpkg-reconfigure locales

PHP: Problem getting date in different locale


Have you ever faced a problem trying to get date in another locale ? The way you can do it right is as follows: You will use set setlocale(), strftime() suppose you want to get the date in Italian setlocale(LC_ALL, 'it_IT'); // Set locale to Italian echo strftime("%e %B %Y"); //today's date echo strftime("%e %B %Y",strtotime($date)); //another … Continue reading PHP: Problem getting date in different locale