Change Thunderbird default browser in XFCE

XFCEI had to change the default browser in Thunderbird but there was no clear way to do that, recently I found the solution.

I’ve tried to update the alternatives with

update-alternatives --config x-www-browser

but it just got ignored, the solution is to change the settings in Thunderbird’s config editor (Preferences > Advanced > Config) and search for network.protocol-handler.warn-external.http and network.protocol-handler.warn-external.https and set them to true, this will ask you what browser Thunderbird should use to open the links, just check “remember the setting” and set your preferred browser.


2012 in review

The stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

600 people reached the top of Mt. Everest in 2012. This blog got about 5,800 views in 2012. If every person who reached the top of Mt. Everest viewed this blog, it would have taken 10 years to get that many views.

Click here to see the complete report.

Text editor to develop the web?

Since I’m taking the tests on P2PU and the #3 Choose Your Weapon test ask you about this topic, I was wondering what text editor you prefer and why!

Drupal 7: Add a class to the body

Drupal Today I had to add a class to the body so know if I was logged in as “administrator” like role, it needed to have the permission to modify any content of the type MYTYPE.

To add a class to the body you have to work on the template_preprocess_html for your theme, like the snippet below.

function MYTHEME_preprocess_html(&$vars) {
  if(user_access("edit any MYTYPE content")){
    $vars['classes_array'][] = "MYCLASS";

The user_access() will check if the current user (if there isn’t one specified) has the selected permission, the permission is the one you can see from the permission administration page, if you are using Drupal in another language then refer to the base English interface to know what to write there.


Drupal 7: Manually update jQuery version

Drupal Today for a customer I had to use a special plugin for jQuery that needs a jQuery version equal or major than 1.6.1.

As you know Drupal 7 is shipped with jQuery 1.4.4 and so is not ready for the plugin I need to use, there is a plugin that update jQuery and jQuery UI but where is the fun?

The procedure is pretty quick:

  • Download the jQuery version you need from from the official source.
  • Place the jQuery version you downloaded in your theme js’s folder (like MYTHEME/js/).
  • Create/Modify your theme’s template.php file as described below.

That is.

Now for the template.php, you need to use the hook_js_alter to replace the native jQuery:

function MYTHEME_js_alter(&$javascript) {
  //We define the path of our new jquery core file
  //assuming we are using the minified version 1.8.3
  $jquery_path = drupal_get_path('theme','MYTHEME') . '/js/jquery-1.8.3.min.js';

  //We duplicate the important information from the Drupal one
  $javascript[$jquery_path] = $javascript['misc/jquery.js'];
  //..and we update the information that we care about
  $javascript[$jquery_path]['version'] = '1.8.3';
  $javascript[$jquery_path]['data'] = $jquery_path;

  //Then we remove the Drupal core version

After we clear the cache we will have the new jQuery version.

Keep in mind that changing the jQuery version may create some incompatibility issues with the other Drupal core scripts.



Who use linux systems may encounter the following error:

W: GPG error: testing Release:       
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB563F93142986CE

W: There is no public key available for the following key IDs:      

The ID is different everytime but the solution is always the same:

# gpg --keyserver --recv-key YOURSEGNALEDID
# gpg -a --export YOURSEGNALEDID | sudo apt-key add -



Magento checkout agreements missing

Magento I had to work on a Magento template that was bought and assumed to be in a “fully functional and anatomically correct form” (cit), except that it was not able to show the checkout agreements in the checkout process even if the standard procedures are all done correctly.

The problem was (of course) in the XML layout of the checkout page (checkout.xml) where the block that was supposed to output the agreements, here below:

<block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>

Was positioned in the wrong place, in my case it was inside the “Review” element of the checkout:

<block type="checkout/onepage_review" name="" as="review" template="checkout/onepage/review.phtml">
  -- stuffs --

That is pretty wrong! This error will make impossible for customers to complete the checkout process as the system will spam pop “Hey you did not accept the agreements!”. That block is supposed to stay inside the info block of the review:

<block type="checkout/onepage_review_info" name="root" output="toHtml" template="checkout/onepage/review/info.phtml">
  -- many stuffs --
  <block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>

At this point a simple cache refresh fixed the issue and get the checkout agreements in the checkout page.