From The Blog

Drush command terminated abnormally due to an unrecoverable error

28 October 2016, in

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 was to add a condition to check before doing the drupal_goto() to check that the source is not from drush:



Post a Comment

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

21 March 2016, in

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:



Post a Comment

Drupal7 Views3: Empty "Row style output" templates

20 May 2015, in

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 display "Format" shows "Content" not "Fields", so it shows rendered content and can not have row style templates.



Post a Comment

Drupal variable functions automatic serialization

1 April 2012, in

Drupal's variable functions automatically serialize and unserialize variables

so, variable_set automatically serialize variables, and variable_get automatically unserialize variables



Post a Comment

Drupal: doing an action in more safe way as another user.

30 January 2012, in

To do an action as another user "Administrator for example" for any reason "maybe to run it in a cron job" in a safe way:

global $user;
$currentuser = $user;
session_
save_session(FALSE);
$user = user_
load(array('uid' => 1));

//action_as_another_user_here();

$user = $currentuser;
session_save_session(TRUE);



Post a Comment

Drupal file_copy won't work outside of the Drupal installation directory

9 January 2012, in

The selected file could not be uploaded, because the destination is not properly configured

This "feature" has bitten me before. It's one of those annoying Drupal things which would be fine if the error message wasn't so misleading.

What's happening is that file_copy() calls file_create_path()

<?php
function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
$dest = file_create_path($dest);
?>

 



Post a Comment