Love the inline registration module and the idea behind it, but am unable to get it to work with Email registration (http://drupal.org/project/email_registration) enabled. I'd basically like to get rid of the "Choose a Username" form. Any help in having the two modules working together would be greatly appreciated. Cheers.

Comments

kulfi’s picture

subscribing

Hwangar’s picture

I think I can realise what can be happening... I ported recently to D6, I'll correct it because it's another module I use...
I'll post it soon.

xamount’s picture

I struggled with this same exact issue and this is what I did to overcome it. I created a custom module and inside hook_form_alter I put:

 if ($form['type']['#value'] . '_node_form' == $form_id && arg(1) == 'add') { // This is a node/add form
    global $user;
    if ($user->uid == 0) { // User is not logged in

      // Add the user registration form to the node/add/page
      $form['register'] = array(
        '#weight' => -99,  //this is the most important bit
      );
      $form['register']['form'] = user_register();
      
      $form['register']['form']['name']['#type'] = 'hidden';
      $form['register']['form']['name']['#default_value'] = 'not_applicable';

      // Remove the user_register submit button in favor of the node submit button
      $form['register']['form']['submit'] = NULL;
  }
}
livido’s picture

This module dont call hook_form_alter for user_register form then this module can not integrate with other module that hook alter user register form.

But we can change a little to use with other module .

Sample with Email registration module :

Change the line 24 :

$form['register']['form'] = user_register();

to :

$user_register_form = user_register();
email_registration_form_alter('user_register', &$user_register_form); // manually change form alter. 
$form['register']['form'] = $user_register_form;
xamount’s picture

My previous suggestion is cleaner as you don't actually have to edit the email_registraion.module (hence it will be easier to upgrade). If you did it my way, all the changes will go in your own custom module.

livido’s picture

Status: Active » Closed (fixed)

I added the callback to form alter for user-register form. So you don't need any modification more.

najibx’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Status: Closed (fixed) » Active

Hi, just to confirm current status on D6 as I'm not getting it as expected without any modification. Email registration works only when registering new account not when adding content (content type with enabled inline registration). Username still shows up.

Inline Registration 6.x-1.x-dev 2009-Apr-07
Email Registration 6.x-1.x-dev & 6.x-1.2

Thanks !

pieterdc’s picture

Category: support » feature
Status: Active » Needs review
StatusFileSize
new1.17 KB

Created a patch against today's dev version.
Works on my site (with email_registration 6.x-1.3 and a custom module that further alters the registration form).

twooten’s picture

I tried the patch from #8 and am still getting the "choose a username" field on my inline registration forms. I tried first with email_registration 6.x-1.2, then updated to email_registration 6.x-1.3. Using Drupal 6.16.

I love the Inline Registration module, great job! I'm about to roll it out to about 20 sites today.

Tim

pragnatek’s picture

Thanks @PieterDC for patch in #8. Just what I was looking for.

I'm using this patch with 6.x-1.3 and it does the job very well. It allows other modules to alter the registration form (as well as the inline_registration module) which means hook_form_alter's from other modules such as email_registration, avatar or terms_of_use, now show up along with the inline_registration.

Unless I'm missing any unforeseen consequences, this patch would be worth putting back into the module.

also @PieterDC - are able to share your other "custom module that further alters the registration form"? - you've sparked my interest into what's possible!

pieterdc’s picture

@pragnatek: Imagine! ;-)

pragnatek’s picture

@PieterDC: I'm imagining!

btw I've just hit the issue of the inline_registration + email_registration + logintoboggan(configured for 2 email fields on registration form) fails to check that the submitted emails match. Workaround is just to use 1 email field.

But in my imagination you've already fixed this ;-)

pieterdc’s picture

I haven't. I use only one email field.

geek-merlin’s picture

StatusFileSize
new881 bytes

key is this line:

    $form['register']['form'] = drupal_retrieve_form('user_register_form', $form_state);

but drupal_retrieve_form does not fire the hooks that email_registration uses.

simply changing to

    $form['register']['form'] = drupal_build_form('user_register_form', $form_state);

which fires hooks raises many issues,the simplest of which is having the captcha twice...

so we have to roll a special spliff for email_registration.
(so do we for any other module that shoud do their job...)

patch flying in that works for me!

edit: the patch is for 7.x

doublejosh’s picture

For D6 I tried $form['register']['form'] = drupal_rebuild_form('user_register', $form_state, NULL);, which hides the field but redirects the page back to an empty version again upon submit.

doublejosh’s picture

Whops. Hadn't tried #8 yet, which works.

liberatr’s picture

StatusFileSize
new900 bytes

In response to #14:

email_registration has changed their api - the function has changed to 'email_registration_form_user_register_form_alter'.

updated patch

jdleonard’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
StatusFileSize
new905 bytes

Patch for D7 attached. Thanks for everyone's help.

maked1sky’s picture

Category: feature » bug
Priority: Normal » Critical
StatusFileSize
new39.09 KB

After patching Inline registration and adding node with inline registration appears error- see screen 001.png (sorry that there is russian)

maked1sky’s picture

StatusFileSize
new4.69 KB

there is my Inline registration.module
I may be wrong in the code???

doublejosh’s picture

maked1sky’s picture

I'm sorry I do not understand where to put this code (I have not found ---email_registration_form_alter ()--- in inline_registration and email_registration modules

  // Inline Registration integration.
  if (in_array('inline_registration_submit', $form['#submit'])) {
    $form['register']['form']['account']['name']['#type'] = 'hidden';
    $form['register']['form']['account']['name']['#value'] = user_password();
    $form['register']['form']['account']['mail']['#title'] = t('E-mail');
  }

and if it works with Drupal 7?

cafuego’s picture

Priority: Critical » Normal
StatusFileSize
new1022 bytes

Atatched patch seems to work for me on Drupal 7. Unfortunately it appears to not be possible to invoke all normal form alter hooks inside a form_alter hook, so the code specifically tests for the Email Registration module and calls its alter function.

I've set the bug status to normal, as the lack of integration doesn't actually break anything and doesn't prevent Drupal from working.

maked1sky’s picture

All the same, an error
Notice: Undefined index: name in the function inline_registration_validate () (line 125 in the file)

cafuego’s picture

line 125 in the file

inline_registration.module is only 123 files long after I patch it with the patch from #23.

Anyway, a notice isn't an error. Does the form submit OK and create a user?

maked1sky’s picture

I added patch from here http://drupal.org/node/861448 cause i have 211 strings in inline_registration.module/
May be because of this error

Does the form submit OK and create a user?

No. After sumbit an exception page appears
line 125 in the file:
$form_state['values']['name'] = $form_state['input']['name']; // for some reason the name is empty and a scrypt works incorrectly so copy it from other variable

maked1sky’s picture

StatusFileSize
new7.8 KB

Here my file with inline_registration.module

cafuego’s picture

I added patch from here

That's like trying to work on a moving target. If you're testing patches, please try only one at a time. Once one is applied to the module, if a problem occurs with another patch, you work on that one then. Not before. I appreciate that can be annoying, but I don't want to adjust a patch to someone else's work in progress (especially when it works just fine on the base code).

Jarviss’s picture

Maked1sky using you version of file I get PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users} (uid, name, pass, mail, signature, created, status, language, picture, init) ........... in drupal_write_record() (line 7106 of /includes/common.inc).
Do you also get this error? As I understand it takes empty name and tries to record in user! Better approach is to make username = $account->mail

maked1sky’s picture

Carliton
Yes,after submit node I get "PDOException...."

maked1sky’s picture

Cafuego
I need both the functionality of the inline registration module,because I try to added 2 patches ("integration with email registration module and registration" and "login and registration on the same page")

hazah’s picture

I'm going to weigh in on this a little bit since I've had to correct a number validation/submission quirks with this. I'm not exactly clear on the original approach so I ended up rewriting some aspects of the code to better integrate with other modules and make less assumptions about its environment.

Firstly, within inline_registration_form_alter, this is crucial as it PRESERVES the submission handlers' order for the node. I was completely baffled by the array_reverse choice:

    // Add our own validation and submit callbacks to the node_form before all other
    // submit and validation callbacks.
    array_unshift($form['#validate'], 'inline_registration_validate');
    array_unshift($form['#submit'], 'inline_registration_submit');

Secondly, I removed any assumption that this module makes about how to push the data to their respective validation/submission handlers for registration:

In inline_registration_validate:

  foreach ($form['register']['form']['#validate'] as $callback) {
    if (function_exists($callback)) {
      $callback($form['register']['form'], $form_state);
    }
  }

In inline_registration_submit:

  foreach ($form['register']['form']['#submit'] as $callback) {
    if (function_exists($callback)) {
      $callback($form['register']['form'], $form_state);
    }
  }

If this works for you, please let me know. Thanks.

hazah’s picture

What I posted does not work as is. I'm still hashing out some last details.

jdleonard’s picture

#18 or #23 (only difference is a variable name) combined with email_registration patch https://drupal.org/node/1911574#comment-7858561 solves all integration issues for me.

greggles’s picture

The patch to email_registration is now committed. Is there anything else holding back this patch?

nunoveloso’s picture

Iteration of #23 (cf. interdiff). Solves some issues raised in #32, but with slightly different approaches.
Tested and working so far, please do the same.

Thanks!

nunoveloso’s picture

Title: Getting it to work with Email Registration module » Getting it to work with Email Registration, Login Toboggan and Registration Toboggan modules

Added logintoboggan and registration_toboggan modules to the bunch.

nunoveloso’s picture

Added logintoboggan and registration_toboggan modules to the bunch.

geek-merlin’s picture

Status: Needs review » Fixed

So this is committed.

Status: Fixed » Closed (fixed)

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