user register form for each type of site member?

1 reply [Last post]
marshallexcavating
Offline
Last seen: 8 years 21 weeks ago
Joined: 2011-02-03

I have been trying to build a Drupal 7 site that accommodates three different type of users (a,b,c). I have been trying to set up a simple front page that has three unique "create your account" links to register each user separately. For example:

"create your account a" link opens a user/register page that would have custom fields pertinent to user "a"; Likewise for use "b" and "c". The objective is to assign each user (a,b,c) to a separate role, and have there profile page unique to that role.

I first tried to setup profile2 module and autoassignrol module with out any luck. These two modules do everything I want but don't have a way to have separate user/register pages. The autoassignrol module has a work in progress feature that will supposedly make it possible to have multiple user/register page, but I have been trying to understand the workings but am lost in the entity API approach that is taken. Is there a tutorial on the entity API?

I then tried to build a module that would simply build a block that would add the fields to the user/register page. example module:

<?php
// $Id$

/**
* @file
* A block module returning a user_register_form in a block.
*/


/**
* Implements hook_block_info().
* This hook declares what blocks are provided by the module.
*/

function blocktest_block_info() {
  $blocks['blocktest'] = array(
    'info' => t('blocktest'),
    'cache' => DRUPAL_CACHE_PER_ROLE,
    );
  return $blocks;
}

/**
*Implements hook_form_FORM_ID_alter(&$form, &$form_state, $form_id).
* This hook makes Modification to the form with the given form ID.
* FORM_ID is "user_register_form" this code would run only on the user
* registration form.
*/

function blocktest_form_user_register_form_alter(&$form, &$form_state, $form_id) {
 
 // Add a checkbox to registration form about agreeing to terms of use.
  $form['terms_of_use'] = array(
    '#type' => 'checkbox',
    '#title' => t("I agree with the website's terms and conditions."),
    '#required' => TRUE,
     );
}

/**
* Implements hook_block_view().
* This hook generates the contents of the block.
*/

function blocktest_block_view($delta = '') {
$content = t('Hello World');
 $block['subject'] = null;
 $block['content'] = drupal_get_form('user_register_form');

 return $block;
}

The problem is that this module adds the field to the user/register everywhere it is used so it wont work to build three of these modules for each user. With this problem what strategy should I take to accomplish this task?

Thank you for any advice.
Craig

marshallexcavating
Offline
Last seen: 8 years 21 weeks ago
Joined: 2011-02-03
My best solution to a uniqe registration form per user interest.

Create a custom User Registration form with FAPI D7 resource:
http://drupal.org/node/1063598

I built the "custom User Registration form" in a block like above. Then I use panels module to display my block; This is nice because I can set the path with in the Panels UI and theme the entire panel for each user role/registration separately. I built three of these block user registration modules for each user (a,b,c).

This has been my best approach/strategy to solving multi registration forms and auto setting a Rol at registration. I have chosen to do this hybrid approach of building a custom module that utilizes panels because I like the idea of leverage modules like panels and it has minimized the amount of code I had to write.

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.