1

I'm trying to follow the tutorial on multipage user registrations at http://www.grasmash.com/article/building-multistep-registration-form-drupal-7-using-ctools, but I'm doing something wrong. As it's written, if I put function hook_form_user_register_alter(&$form, &form_state) {, it throws me a Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE error; however, if I change the &form_state to &$form_state, it doesn't complain.

HOWEVER

It seems as if this form isn't replacing the existing form. There's a button added to the registration form Create new account (the standard Drupal continue button is still there). The rest of the standard Drupal form is still the same (just username and password fields).

Thanks for your help

2
  • Which is your PHP version ?
    – niksmac
    May 12, 2013 at 3:31
  • PHP 5.3.13 on WAMP May 12, 2013 at 3:33

2 Answers 2

0

try this

function grasmash_form_user_register_alter(&$form, &$form_state, $form_id) {
  $form['#submit'] = array(
    'user_register_submit',
    'ctools_wizard_submit',
  );
}
3
  • nope - didn't work - thanks, though May 12, 2013 at 8:45
  • sorry I dont have enough information to understand where the problem is all I can tell you is you cant call a function using "hook" you have to replace it with the module name and I think the problem is there if its not I need to ask you if you followed the tutorial step by step as it is so I can try it and see if I get the same error
    – Sari
    May 12, 2013 at 8:57
  • Maybe this will help - my module file is at pastebin.com/ZAuqqrQb, and my inc file is at pastebin.com/rt2B2vkz. The info file is at pastebin.com/JdZ1hf34 May 12, 2013 at 9:12
0

from your question, it is obvious you had a typo in the function header. Php variable name must start with $ but you typed & f o r m _ s t a t e instead of & $f o r m _ s t a t e

The & only instruct that the $f o r m _ s t a t e be passed by reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.