Advertisement
idotherest34

issuewithviewsandsignupform

Apr 26th, 2015
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.91 KB | None | 0 0
  1. <?php
  2. // $Id: signup_form.inc,v 1.3.2.3 2010/12/28 17:28:47 ezrag Exp $
  3.  
  4.  
  5. /**
  6.  * @file
  7.  * Site-specific code related to the form when users signup for a node.
  8.  */
  9.  
  10. /**
  11.  * Return the site-specific custom fields for the signup user form.
  12.  *
  13.  * To customize this for your site, copy this entire function into
  14.  * your theme's template.php file, rename the function to
  15.  * phptemplate_signup_user_form(), and modify to taste.  Feel free to
  16.  * alter any elements in this section, remove them, or add any others.
  17.  *
  18.  * WARNING: If your site allows anonymous signups and you alter the
  19.  * 'Name' field in this function, you will probably have to implement a
  20.  * version of theme_signup_anonymous_username() for your site.
  21.  *
  22.  * In order for the form to be rendered properly and for the custom
  23.  * fields to be fully translatable when printed in other parts of the
  24.  * Signup module (displayed in signup lists, emails, etc), the name of
  25.  * the form element must be $form['signup_form_data']['NameOfDataField'],
  26.  * where NameOfDataField is replaced with the actual name of the data
  27.  * field.  For translation to work, the displayed name of the field
  28.  * (the '#title' property) be the same as the name of the data field,
  29.  * but wrapped in t().  See below for examples.
  30.  *
  31.  * Fieldsets are not currently supported in this form.  Any
  32.  * '#default_value' will be filled in by default when the form is
  33.  * presented to the user.  Any field marked '#required' must be filled
  34.  * in before the user can sign up.
  35.  *
  36.  * If you do not want any additional fields, the function can simply
  37.  * return an empty array: "return array();"
  38.  *
  39.  * @param $node
  40.  *   The fully loaded node object where this signup form is appearing.
  41.  *
  42.  * @return
  43.  *   Array defining the form to present to the user to signup for a node.
  44.  *
  45.  * @see theme_signup_anonymous_username()
  46.  */
  47. function theme_signup_user_form($node) {
  48.   global $user;
  49.   $form = array();
  50.   if (variable_get('signup_ignore_default_fields', 0)) {
  51.     return $form;
  52.   }
  53.   // If this function is providing any extra fields at all, the following
  54.   // line is required for form form to work -- DO NOT EDIT OR REMOVE.
  55.   $form['signup_form_data']['#tree'] = TRUE;
  56.  
  57.  $form['signup_form_data']['Name'] = array(
  58.     '#type' => 'textfield',
  59.     '#title' => t('Your Name'),
  60.     '#size' => 40, '#maxlength' => 64,
  61.     '#required' => TRUE,
  62.   );
  63.     $form['signup_form_data']['Total_Guests'] = array(
  64.     '#type' => 'textfield',
  65.     '#title' => t('Total number of adult guests (including you, assuming you are attending)'),
  66.     '#size' => 2, '#maxlength' => 2,
  67.     );
  68.      $form['signup_form_data']['Work'] = array(
  69.     '#type' => 'textfield',
  70.     '#title' => t('Work this shift?'),
  71.     '#size' => 40, '#maxlength' =>40,
  72.     );
  73.     $form['signup_form_data']['Total_Kids'] = array(
  74.     '#type' => 'textfield',
  75.     '#title' => t('Number of children'),
  76.     '#size' => 2, '#maxlength' => 2
  77.   );
  78.   $form['signup_form_data']['Meat'] = array(
  79.     '#type' => 'textfield',
  80.     '#title' => t('Number of meat dishes (assuming meat is offered)'),
  81.     '#size' => 2, '#maxlength' => 2,
  82.   );
  83.   $form['signup_form_data']['Vegetarian'] = array(
  84.     '#type' => 'textfield',
  85.     '#title' => t('Number of vegetarian dishes (if meat is offered)'),
  86.     '#size' => 2, '#maxlength' => 2,
  87.   );
  88.   $form['signup_form_data']['Dietary_Prefference'] = array(
  89.     '#type' => 'textfield',
  90.     '#title' => t('Please include any other dietary restrictions (not including vegetarian - i.e. gluten free, allergies, etc...)'),
  91.     '#size' => 40, '#maxlength' => 100,
  92.   );
  93.   $form['signup_form_data']['Other_Notes'] = array(
  94.     '#type' => 'textfield',
  95.     '#title' => t('Anything else you would like the chefs to know?'),
  96.     '#size' => 40, '#maxlength' => 100,
  97.   );
  98.  
  99.   // If the user is logged in, fill in their name by default.
  100.   if ($user->uid) {
  101.     $form['signup_form_data']['Name']['#default_value'] = $user->name;
  102.   }
  103.  
  104.   return $form;
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement