This patch allows you to define different signup form theme function on a per-node basis. Just define your theme function ala theme_signup_user_form and implement the hook_signup_form_theme_functions() (I know it's too long a name!). For example:

function theme_custom_user_form() {
  global $user;

  $form['signup_form_data']['#tree'] = TRUE;
  
  $form['signup_form_data']['Designation'] = array(
    '#type' => 'select',
    '#title' => t('Designation'),
    '#options' => drupal_map_assoc(array('Mr.', 'Mrs.', 'Ms.')),
  );
  $form['signup_form_data']['Name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#size' => 40, '#maxlength' => 64,
    '#required' => true,
  );
  $form['signup_form_data']['Address'] = array(
    '#type' => 'textarea',
    '#title' => t('Address'),
    '#rows' => 4,
  );

  // If the user is logged in, fill in their name by default.
  if ($user->uid) {
    $form['signup_form_data']['Name']['#default_value'] = $user->name;
  }

  return $form;
}

/**
 * Implementation of hook_signup_form_theme_functions().
 */
function mymodule_signup_form_theme_functions() {
  return array('custom_user_form');
}

and voila! You can now edit your node and select 'custom_user_form' under the 'Theme function' setting.

Please review; if does not belong in signup core, so be it, at least the patch is here if someone needs such functionality ;)

CommentFileSizeAuthor
signup_form_theme_function.patch10.01 KBedmund.kwok

Comments

dww’s picture

Whacky. ;) I doubt this will go into the main module, but thanks for sharing. I'd personally like to move *away* from using "theme" functions for this feature entirely. There are a few different ideas floating around, but i haven't had any need, and certainly not enough time, to work on any of them. See, for example: http://groups.drupal.org/node/3430

edmund.kwok’s picture

Yeah, using the theme approach is not the best method. It's not the most user friendly approach and might not appeal as knowledge of FAPI is required. But I think it's the most possible method without much changes to the module.

I would go with something similar to a form builder function, CCK, but that would mean an overhaul of signup module. I don't even know where to start :p

Good discussion on g.o. going on. We'll wait for and see who'll start the ball rolling with those ideas :)

dww’s picture

Status: Needs review » Postponed
socialnicheguru’s picture

subscribing.

how do i just have a signup button for authenticated users that just fills in the information that I need.

I suppose I can do a popup/ajax for anonymous users to fill in their information.

Chris

dww’s picture

Status: Postponed » Closed (duplicate)

@activelyOUT -- that question has nothing to do with this issue, please don't hijack existing issues with your support questions. Thanks.

Also, upon further consideration, this seems entirely duplicate with the older issue over at #29568: Flexible number and type of fields.

akaserer’s picture

Version: 5.x-2.x-dev » 6.x-2.x-dev
Status: Closed (duplicate) » Active

hello

is there a way to do this in drupal 6???

thanks

dww’s picture

Status: Active » Closed (duplicate)

Still duplicate with the issue I linked to in #5.