Category Archives: CMS

Drupal – Remove Revision Information, Authoring information and Publishing options in Node Form

If you want to hide the revision information, authoring information as well as publishing options, the Formfilter module could help.

Download and enable the module and login as admin. you will find out there is a link named as Filter all node forms in any node edit form. Continue reading Drupal – Remove Revision Information, Authoring information and Publishing options in Node Form

Drupal – Webform Dynamic Default Value

You can set some dynamic default values for the Webform fields. Put the one of the following values.

%username
%useremail
%site
%date
%server[key]
%session[key]
%get[key]
%post[key]
%request[key]
%profile[key]

Continue reading Drupal – Webform Dynamic Default Value

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 – 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