Closed (duplicate)
Project:
Signup
Version:
6.x-2.x-dev
Component:
Themeability
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2007 at 07:07 UTC
Updated:
20 Nov 2010 at 19:49 UTC
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 ;)
| Comment | File | Size | Author |
|---|---|---|---|
| signup_form_theme_function.patch | 10.01 KB | edmund.kwok |
Comments
Comment #1
dwwWhacky. ;) 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
Comment #2
edmund.kwok commentedYeah, 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 :)
Comment #3
dwwComment #4
socialnicheguru commentedsubscribing.
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
Comment #5
dww@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.
Comment #6
akaserer commentedhello
is there a way to do this in drupal 6???
thanks
Comment #7
dwwStill duplicate with the issue I linked to in #5.