Tag Archives: Drupal

Drupal – Quick Tabs Deep Linking

The Quick Tabs allows you to aggregate different content in a single page using tabs. You can either load all the tabs at once or use Ajax to retrieve the tab content. But in both cases, you can’t get the direct link of a specific tab.

So i create the following Javascript to tackle this problem. After applying it, the page will reload every time when the user click the tab and the URL is also updated. Continue reading Drupal – Quick Tabs Deep Linking

Drupal – Admin Module $.cookie is not a function Error

Recently i need to migrate a Drupal 6 website to a hosting. Everything seems work fine but the Admin module fails to work. The following error is shown in Firebug console.

  • $.cookie is not a function

Continue reading Drupal – Admin Module $.cookie is not a function Error

Drupal – Form Path Problem of Exposed Filter Block in Panel Page

In Views, we can make the exposed filter into block and therefore we can select it for Panel page. But this would not work because after the filter form submission, it will redirect to the view page rather than the current panel page.

Luckily, i found a solution to resolve the issue. Continue reading Drupal – Form Path Problem of Exposed Filter Block in Panel Page

Drupal – Add HTML Markup in Form

I would like to add some HTML elements in the login form. This can be done by hook_form_alter() and the markup could be added as follow.

function <your module>_form_alter(&$form, &$form_state, $form_id) {
  //print $form_id.'<br/>';
  if ($form_id == 'user_login') {
    //print_r($form);
    $form['html_markup'] = array('#value' => t('<a href="https://ykyuen.wordpress.com">Eureka!</a>'));
  }
}

 

Done =)

Reference: Drupal 6 Form API Reference

Drupal – Customized User Registration/Login/Forgot Password Page with Panel

Update @ 2012-12-30: Here is much simpler approach proposed by tombehets. Thanks =D

/**
 * Implements hook_menu_alter().
 */
function mymodule_menu_alter(&$items) {
  //redirect user/register to register, our custom panel.
  $items['user/register']['page callback'] = 'drupal_goto';
  $items['user/register']['page arguments'] = array('register');
}

 

Panels is a very useful module in Drupal which helps us to customized page view with specific layout. Unfortunately, it does not support the User Login, User Registration and Forgot Password pages.

Luckily, I found a simple workaround on Google. The idea is just creating a custom panel page as usual and add a custom panel pane with the desired form as follow. Continue reading Drupal – Customized User Registration/Login/Forgot Password Page with Panel

Drupal – Render Forgot Password Form by drupal_get_form()

Update @ 2013-05-30: The piece of code in this post works on Drupal 6. If you are looking for Drupal 7 solution, please refer to the comment made by Matthias. Thanks Matthias. =D

If you want to print the Forgot Password form with drupal_get_form(), you have to include the user module.
Try the following piece of code.

<?php
  // Drupal Forgot Password Form
  module_load_include('inc', 'user', 'user.pages');
  print drupal_get_form('user_pass');
?>

 

Done =)

Reference: printing the ‘request-new-password’ form

Drupal – Increase Views Relationship Delta Limit

The relationship delta in Views helps you to link a specific referenced node. but it only has 1 to 10 options. I want to increase the delta limit, so let’s hack the CCK module. Yes, the CCK module instead of the Views module. =P

Open cck/includes/views/handlers/content_handler_relationship.inc and modify the $max_delta as follow. Continue reading Drupal – Increase Views Relationship Delta Limit