How to configure sign up button without phone and name field?

held69 - March 18, 2009 - 19:43
Project:Signup
Version:6.x-1.0-rc6
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Without succes i have been searching to disable the phone and name field in the sign up block on my event node.
A sign up button only, similar to http://groups.drupal.org/node/19324 would be just fine.

How can i configure this?

#1

dww - March 18, 2009 - 21:04
Status:active» fixed

See point #2 in the INSTALL.txt file.

#2

held69 - March 19, 2009 - 10:43

Thanks, i kind of overlooked this file.

Despite that i have hardly any experience with php i want to give it a trie to remove the NAME and PHONE field.
I have read the instructions in the install file and the signup_form (theme) as well.
This leaves me with some questions though.

To customize this for your site, copy this entire function into
* your theme's template.php file,

1.I'm a bit confused here by the words "entire function". Can i just copy everything from the signup_form into my
theme's template.php file?

2.Do i have to paste it at the top or the bottom of my theme's template.php file? Or does it make no difference.

rename the function to phptemplate_signup_user_form(),

3.So in function theme_signup_user_form($node) i rename theme_signup_user_form into
phptemplate_signup_user_form?

and modify to taste.

4.So now i'm left with this code. What do i alter?
Can i just remove the blocks with phone and name in it?
The words "DO NOT EDIT OR REMOVE" are not making me feel very secure :)

// If this function is providing any extra fields at all, the following
  // line is required for form form to work -- DO NOT EDIT OR REMOVE.
  $form['signup_form_data']['#tree'] = TRUE;

  $form['signup_form_data']['Name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#size' => 40, '#maxlength' => 64,
    '#required' => TRUE,
  );
  $form['signup_form_data']['Phone'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone'),
    '#size' => 40, '#maxlength' => 64,
  );

  // 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;
}

Thanks

#3

dww - March 19, 2009 - 16:16

(Side note: this whole thing is stupid and crazy, and should go away. See #29568: Flexible number and type of fields)

I guess you missed this in the comment above theme_signup_user_form():

* If you do not want any additional fields, the function can simply
* return an empty array: "return array();"

So, all you need is to put this in template.php (and no, the order doesn't matter at all):

function phptemplate_signup_user_form($node) {
  return array();
}

Cheers,
-Derek

p.s. If someone marks your support request "fixed", and you still have questions or can't get something working, you should set it back to "active". However, since I just answered your question, I'd set it back to "fixed" with this comment. ;) So, assuming this works for you, you don't have to reply at all nor change the status.

#4

held69 - March 21, 2009 - 00:25

Derek,

Thank you very much.

It worked straight out of the box.

#5

System Message - April 4, 2009 - 00:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#6

modctek - October 5, 2009 - 18:15
Version:6.x-1.0-rc3» 6.x-1.0-rc6
Status:closed» active

I've noticed that this work-around does not work with signup_status enabled, possibly because the function call has been co-opted or renamed. Any hints how to proceed without disabling signup_status?

#7

dww - October 5, 2009 - 18:42
Status:active» closed

It works fine. Of course, if you have the signup_status module enabled, and some options configured to appear on the signup form, those are *going* to appear on the signup form. That's obviously by design. ;) This support request is about hiding the custom fields like Phone and Name, and it works (I just re-tested to be sure) exactly as described here, even with signup_status enabled.

 
 

Drupal is a registered trademark of Dries Buytaert.