Blog

Modifying a view with hook_views_query_alter

If you ever find yourself in a situation where you need to manually change the some parameters in a view then hook_views_query_alter() is your answer.

I had a situation where I had a view of CTA links. These links consisted of a title/image and link to the content. These displayed a the bottom of the article content types. Each CTA had a path to a specific article. The problem was that I didn't want the same link to display on the article that was current. So to do this I used hook_views_query_alter().

 

Sending a webform to a different email based on country

I can confirm that this work around does seem to work. Whether it's a good way to do it or not is another matter. This webform hook is called after being submitted to the db but I don't think it matters where it's done. It basically uses the country codes generated by the country select box to define the email used

<code>
<?php
function MODULE_NAME_webform_submission_insert($node, $submission) {

if ($node->nid == WEBFORM_NODE) {

Unable to login to admin

I had a problem, I developed a site on apache on a windows machine, but I also wanted to develop the site on my Linux (Ubuntu) laptop. After transferring the site across, files and database I just couldn't login. Whatever I did it just went back to the login screen without logging in.

I tried every solution out there, changing the password hash code through the database, changing the password through drush. Absolutely nothing worked. Finally I found the answer and I hope it works for others. But don't be surprised if it doesn't.

F1 delays 'Green' engines

I was a bit sad today to find out that F1 has decided to delay the introduction of 'greener' engines. Read about it here. The plan was to introduce 1.6 litre 4 cylinder turbo charged engines in to F1 in 2013. There has been similar engines in F1 before reaching over 1000 bhp. I was looking forward to it, not just because they were 'greener' but also because it could have been reminicent of the 80s. Instead they have come to a comprimise and V6 engines will now be used starting in 2014.

Custom HTML in Drupal 7 menus

One of the things I find with Drupal is although the documentation is very good it's often quite hard to get the information you need, especially when it comes to just straight forward walk throughs of how to do things. I had a problem where I needed to add a vertical line between my inline menu items. Check out the portfolio page to see what I mean. I wanted it on that menu alone and no other. Well obviously what I had to do was change the HTML output by adding in a line like

Roger Waters, David Gilmour, The Wall ..... and Nick Mason

About a year ago I received an O2 alert for tickets to the O2 arena for Roger Waters 2011 "The Wall" tour of the UK. Having been a huge Pink Floyd fan since my late teens and never having opportunity to see any members of Pink Floyd perform this was an opportunity not to be missed. So I emailed my brother Phil and my girlfriend Marie and asked if they would want to go. Phil is also a huge Pink Floyd fan and Marie, not knowing The Wall particularly well but knowing what it means to me both happily accepted the invite.

Subscribe to Blog