The Drupal Members Page module

Diogenes's picture

Drupal sites are subject to web-bot registrations that target Drupal's /user/register url.

The Members Page module was crafted to fight this nuisance by creating a dedicated members page and registration page. The latter is available even if /user/register access is blocked. For added security, both page locations (url's) can be changed. Web-bots simply don't know where to look.

Downloads

The Members Page module is available for Drupal versions 6 & 7. The latest versions are available here:

https://drupal.org/project/members_page
 

Installation and Evaluation

Members Page does not depend on any other modules (except for one extended feature).  Enabling the module does not alter your site configuration in any way although some configuration changes are necessary for practical use.

Disabling and uninstalling the module will remove any site variables and tables entries (D6 only) from the database, restoring your development site to it's original state.

Feedback appreciated

If you install the Members Page module and find that it works as described here and even useful, we appreciate any endorsements and recommendations you pas on to us or others.


The Members page

The Members page has a two panel content block with three different viewing modes:

  1. for the anonymous visitor
  2. for the member -- a user who has logged in by way of a session cookie or by providing a valid username and password
  3. for admins or members who have edit permissions

The visitor view has a greeting, a login block for existing members, and a link to a special registration form for new members. This registration form has elevated privileges. A visitor who completes this form will be registered immediately without admin approval (but still subject to email verification) regardless of the current site settings.

The members view has a greeting and a personalized configurable user-menu block.

Both greetings can be edited -- a good place to encourage sign-up of new members or to publish news items or new links for your current members.

The Members Page module has two novel features:

  1. Re-configurable url's
  2. Magic block rendering

Re-configurable url's

A re-configurable url in this context is a drupal hook_menu() item whose value (path) is stored as a drupal variable.

Now it is perfectly acceptable to ask what that last sentence means. Perhaps the best way to illustrate this is to show where this module uses this feature. 

Many Drupal contributed modules create custom pages for the site or alter existing pages on the site. This module does both. There are two custom page rendered: the members page and a special registration page. The difference here is that both of these page locations (url's) can be changed.

These values are stored as Drupal variables, which means that every site can have it's very own url for a login page or new account.

 

 


Magic block rendering

Maybe magic block is a goofy name to use here but I'm open to suggestions.

A magic block in this context is a Drupal block that is rendered specifically for the module content without regard to the site configuration.

Every drupal page display is divided into regions. The number of regions and their placement depends on the site theme. Each region in turn may contain one or more blocks. Drupal was designed to allow any block to appear in any  region on any page (this is awesome).

A normal Drupal block appears on any given page according to a configuration that is recorded in the database.

A magic block is a block that always appears on a given page regardless of the drupal block configuration settings. In essence, it creates a block db fetch object from scratch and then uses the same drupal core functions to render that block on the target page. 

In other words, a magic block always appears on the page it was designed for. It does not affect the existing configuration or placement of the normal block.

A magic block and a normal block can coexist on the same page. It is entirely possible (and probable) that you will see the same two blocks on the same page -- more on this later.

There are 3 magic blocks deployed in the Members Page module: the Login block (from the user module), the User-menu block (from the system module) and our own special bogus login block (members_page module).

The next 3 screenshots show the members page in admin mode, where an admin can create new greetings for existing members and new visitors.

In this example, CKEditor has been enabled here (this module is WYSIWYG ready).

The user-menu block appears for logged- in members. The items listed in this menu block depend on what permissions the current user has.

Drupal 7/8 already has a User-menu and a User-menu block defined. The Drupal 6 version of this module creates these same elements for the same purpose.

The bogus-login block simply serves as a dummy placeholder for the admin mode. Since the regular login block is only available for the anonymous visitor, we reckoned something was need to fill the empty space.

Now these screen shots are from a real site with my own theme.  Here are the Drupal 7 default displays:

Drupal 7 default displays - admin mode



This is a screen shot of the Members Page for the anonymous visitor after a fresh Drupal 7 install with the Members Page module enabled. Astute viewers may notice that there are two login blocks.

The login block on the left is the (almost) standard drupal login block, configured by default to appear on most every page for the anonymous visitor. The login block on the right is the Members Page magic block and it that will appear on this page no matter what the site configuration is.

They are almost identical. Both work too -- you can use either to log in.

Having two login blocks on the same page is not considered a best practice; but this can be corrected by a slight reconfiguration.  Set the region setting to -None- on the User login block configuration page:

/admin/structure/block/manage/user/login/configure

Features / Operation

The Members Page module alters or removes all links that point to the standard /user/register page. After enabling the module, the only way to reach the standard /user/register page is by entering the url into the address bar of the web browser.

The only way for a site visitor user to reach the special visitor registration page (which looks exactly like the /user/register page) is by clicking on the Create new account link found on the bottom of the members page.  Even then, this link appears only to the anonymous visitor.

Comment and Reply links

The two separate links that appeared as 'Login or Register to comment' have been replaced by a single Add comment link that points to the current Members Page url. The Reply link found on visitor comments has also been altered to point to the dedicated members page.

User-menu links

Drupal 7/8, by default, uses the links of the user-menu as the source for the secondary menu.  This means these links may appear in two places on the Members page, once on the secondary menu, the other in the user-menu block.

The secondary menu can be removed on the /admin/structure/menu/settings page.

Members Page menu link

Every time a site admin changes the url for the members page, all menu links are rebuilt. This results in an enabled menu link (Members Page) appearing on the Main menu (D7/D8) or the Navigation menu (D6) to point to the new location of the members page. Any re-configuration of that menu item (renaming or relocation) that was done previously but after the last url change will have to be performed again.

Log out redirect

Clicking on the Log out link anywhere on the site redirects the site user to the Members page Login box.

Username focus

When the members page is loaded, the cursor automatically appears in the username field of the login box, ready for input.


Login link Trackback

Drupal versions 6, 7 & 8 all have login link trackback -- an anonymous visitor who clicks on a Comment or Reply link will be directed to a login dialog box. After submitting a valid username/password, the user is directed back to the page where he or she originally clicked on the Comment or Reply link.

The Members Page module has extended this feature to a visitor creating a new account.  Upon submitting a username an verification email address, a link to a one time login page is emailed to the new member. After clicking on the link, the new member is directed to his user profile form to submit a new password. After this is completed, the user is directed back to the page for comment.

To extend the trackback to a new user registration, it is necessary to enable the Token module and add the 'destination' token to the login-uri in the Welcome (no approval required) email message -- see the Account Settings page (/admin/config/people/accounts).

Detailed instructions for this implementing the new account trackback feature be found on the Members Page module help page .

CSS styling tip

As mentioned previously, two login blocks may appear on the members page after the module is enabled, the first being the normal drupal block, the second being the magic block. Though both blocks are similar, they are rarely exactly the same.

To achieve a simlar look, magic login block has an enclosing <div> and class attribute that matches the typical login block for most themes -- i.e. with the login block being configured to appear in a sidebar.

So for most themes, the magic block will be similar to the normal block, and with a few CSS tweaks, can be made to look exactly the same.

The two login block display, as silly as it seems, gives the themer an opportunity to compare the CSS of the two blocks side-by-side.

Usually only a couple of new CSS rules are needed to make the magic block look exactly like the normal login block.

 


One of these things just doesn't belong here

I have this song in my head -- it may be from Sesame Street.

The following screen shots are of the Members Page in anonymous mode with the normal login block configured to appear on every page (i.e. the drupal default install).  The different shots are with different themes. The point here is to show the similarity between normal and magic login blocks and how easy it can be to make them look exactly the same.

Drupal 6 Gallery



Drupal 7 Gallery





 

Future releases

The next major update of the Members Page module will add drupal tokens into the Visitor/Members greeting.  You'll be able to personalize the member greeting like you can personalize an email.

On a closing note

Of course, it wouldn't be proper to offer this amazing module without a live demo, would it? This site has implemented the Members Page module and we are going to have a little fun with it.  It's kind of a a Turing test for those who have read and understand this page.

Add a comment or Reply to a comment below.  Note the url for the Login page. Now click on the Create new account link. Again, note the url.

No web-bot programmer would program for this particular /user/register url.  But you, my fellow drupalista, should have no fear of this url - because you know exactly what is going on.

This is a limited time offer.


 

Comments

Dilbert's picture
Mordac informed the pointy-haired one of my web activity. PHB then attempted to corner the market after he managed to find an alternate source in Elbonia that Apple had over looked. We are expecting the first shipment of 57,000 squirrels anytime now.
12 years 2 months ago