I want to use Signup without additional form fields. I removed all fields within theme:

function theme_signup_user_form() {
  $form['signup_form_data']['#tree'] = TRUE;
  return $form;
}

When i hit the 'Sign up' button this results in an error telling

warning: array_merge() [function.array-merge]: Argument #1 is not an array in /www/.../modules/signup/signup.module on line 1360.

Signup works as expected but this error always appears.
What is the best practise on removing all form fields as used at groups.drupal.org?

Thanks, Ronald

CommentFileSizeAuthor
#2 signup_empty_form.patch990 bytesdww

Comments

dww’s picture

Component: Themeability » Code
Assigned: Unassigned » dww
Category: support » bug
Status: Active » Needs review

groups.drupal.org does a hack to get around the problem:

function phptemplate_signup_user_form() {
  global $user;

  // This line is required for this form to function -- DO NOT EDIT OR REMOVE.
  $form['signup_form_data']['#tree'] = TRUE;

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

  return $form;
}

They never hit the error since only logged in users have signup perms on the site.

However, this is a hack to work-around a bug. It's a problem that signup.module assumes you have fields there. Here's an initial patch to fix the underlying bug. Give it a try.

The patch should also modify the comments in the default theme_signup_user_form() function, to say it's ok to replace the whole function with a theme function that just does "return array()" in cases where you don't want any extra fields at all, and to clarify you only need the #tree stuff if you define fields. But, first, please give this a try and see if it solves the problem for you.

Cheers,
-Derek

dww’s picture

StatusFileSize
new990 bytes

Oh yeah, the patch... ;)

rokr’s picture

Hi Derek,

the patch works for me as expected. Thanks for the fast answer!
I hope this goes into the next realease for easy updating. :-)

cheers, Ronald

dww’s picture

Version: 5.x-2.4 » 5.x-2.x-dev
Status: Needs review » Fixed

Committed to HEAD and DRUPAL-5. This will be out in 5.x-2.5 and 5.x-1.1 whenever I release those, and in the -dev snapshots in about 5 hours. ;)

socialnicheguru’s picture

subscribing...

i wanted to have my logged in users be able to just hit Signup and be signed up for the event without having to be taken to a different page.

How would I accomplish that?

Chris

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

vardhand’s picture

I want to remove the existing default signup fields and add new fields that will show up on the signup form. I did what the instructions in the INSTALL.txt said, but the new fields do not show up. What am I missing? Any help would be appreciated.

Here is what I added to the the template.php in the salmanaderskins folder.

/* Signup form override */
function salmanderksins_signup_user_form($node) {
global $user;
$form = array();

// 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']['AttendeeCount'] = array(
'#type' => 'textfield',
'#title' => t('Attendee Count'),
'#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;
}

Tino’s picture

@vardhand, I just posted the same problem for 6.x-1.x-dev when I saw yours. Have you been able to figure this out?

edit: Fixed. Clear cache on the performance page...