Transform drupal search result page to infinite scroller

  • 9 April 2013
  • mohit.aghera


If you want to transform pager of any page to infinite scroller you can do it using infinite scroll javascript.
To set it on any page, you will need a couple of steps:
I have transformed the search result page to infinite scroller.
For detail instructions you can follow this guide on
1) Download (jquery.imagesloaded.min.js) place it in your theme folder YOURTHEME/js
This will make sure all images are loaded before activate the infinite scroll.
2) Download

Add links to login block

  • 10 January 2013
  • mohit.aghera

In one of my requirement I had two registration for two users. User had two roles. We have to build seperate form for two user registration.

I created two profiles using profile2 module and using profile2reg path module i got the seperate distrinct registration url for both the roles.

By registrating from the specific url user will automatically get the respective role.

Now to give the seperate registration link for user we have to alter registration form using hook_form_alter() function.

Here is the code snippet how to achieve it.

In any case if we want to add some more links to user


Inplace Editing in Drupal 7 with Edit module

  • 10 January 2013
  • mohit.aghera


How i manage inplace editing using edit module.
In drupal 8 there is inplace edit feature is in drupal core. It is really awesome feature. Now i wanted to achieve same feature in drupal 7 also.
There are lots of alternatives like
1. aloha module
2. Edit module with fape module.
I don't know the reason but i selected the second approch. So i installed the edit and fape module.
After successful installation module started behaving very strange like after one inplace edit it was showing error and when we go to other node for editing purpose
it was showing error.
Fatal error:

Limit the Depth of comment to certain number

  • 22 November 2012
  • mohit.aghera

In Drupal 7 you might have observed that when you enable the comments on any node at that time it also allows you to add the comments.

In each comment there is link to add the replay, but drupal doesn't provide any management to limit the depth/number of replay using interface or any module.

But we can customize using hook_preprocess_HOOK().

For comment display we have to create hook like themename_preprocess_comment() function in template.php file of theme.

After that we have to find the depth of the comment tree. You can find it using $variables['elements']['#comment']->depth variable.