5

One of my requirements is to show the user registration form in an overlay kind of interface.

From the Examples module issue queue, comment #14 http://drupal.org/node/930058 I found a module, learned the hook_admin_paths() and hook_admin_paths_alter(). I installed that module in my local test site. Added "user/register" path to $paths of hook_admin_paths() and granted permissions to use overlay. It works pretty much as expected with the click event however my requirement is to trigger the overlay for onpageload event.

I tried calling a js script which would trigger click event from hook_overlay_parent_initialize() and module's info file by settings scripts[] = myoverlay.js.

The js script looks as below,

(function ($) {

Drupal.behaviors.loginLoad = {
  attach: function (context, settings) {
    alert("trigger client event"); // works 
    $(".menu-589 a").attr("title", "click"); // works
    $(".menu-589 a").trigger("click"); 
    // This one didn't work. Tried triggerHandler() and click() as well.
  }
};

})(jQuery);

My jQuery expertise is very limited. I'm trying to figure out how the overlay fires for onclick event.

From what I learned the paths to be opens in overlay are defined in Drupal.settings.overlay.paths.admin. And overlay-parent.js and jQuery BBQ does some tricks to show things in modal window.

Any help to figure out this will be appreciated.

On a side note : For Drupal 6 projects I have used modal frame api module often with onclick event. This module doesn't seems to be available for Drupal 7 and it is going to be deprecated in favor of overlay in core. Is overlay an API module ? It doesn't appear to be the case from my experience.

  • 1
    I think I'd try to do this without custom code. Have you tried using Lightbox2 or Colorbox? Both provide a way to simply add an argument to a link or a class on a div and do a popup/overlay. – rfay Nov 27 '11 at 16:12
  • You also might want to look at the Fancy Login module, which does this for user/login. I'm sure you could do the same with registration (and offer a patch to this module) as long as the form is relatively small. – rfay Nov 27 '11 at 16:49
  • rfay, thanks for your reply. I have been able to partially achieve it with colorbox module however I have some problems I'm trying to solve it one by one. I will keep you posted on the problems and fixes when I'm done. – Sivaji Nov 28 '11 at 12:23
  • Have you given a look at CTools? It exposes a simple modal window API. – amateur barista Dec 12 '11 at 16:12
1

I you need something like this site http://www.hospitalsreview.com/ has done for the sign up then you should try my module it will surely help you as you can see it is working on my site.

Sign Up Module

1

For Flocknote, I had to put the registration form/page inside an overlay that loads for users who are not logged-in on certain pages. Here's an example: http://www.flocknote.com/community

You'll notice that, when you visit that page as an anonymous user, there are some URL params added, namely ?reg=true#overlay=register/overlay/246. Adding the '#overlay=path/to/node' should make a page open in the overlay. (I can't remember if what else I was doing with the 'reg' variable.)

I basically run a bit of code inside a custom module's hook_init() implementation that says: "If the user is anonymous, and this is a network node home page, drupal_goto() the same URL, but with the fragment overlay=register/overlay/[nid] added on."

This seems to work great for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.