# Summary

Let users register with a password on the registration form when verification mail is required.

By default, users can create accounts directly on the registration form, set their password and be immediately logged in, or they can create their account, wait for a verification e-mail, and then create their password. With this module, users are able to create their account along with their password and simply activate their account when receiving the verification email.

# Project URL

https://www.drupal.org/project/user_registrationpassword

# Where is the code?

https://github.com/swentel/user_registrationpassword

# Estimated completion date

Week of 20 may.

# Dependencies

None

# Who's doing the port?

swentel

# What help do they need?

#2765437: _user_mail_notify() always sends emails even if $notify is FALSE

# D8 roadmap

N/A

# Background and reference information

N/A

CommentFileSizeAuthor
#9 2728255-9.patch6.35 KBgambry
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swentel created an issue. See original summary.

swentel’s picture

Code is available on github. Tests are green.
It's a mimimal port where I left out

- commerce integration
- the whole install/uninstall dance of the activation mail

It needs a double check on language when sending the as well.

But maybe this can be merged in already ?

swentel’s picture

Adding credits

Rob C’s picture

Great work, sadly i was also working on a port, but never finished, so thanks. Do wonder about how you got it all to work, i'll do a code review + test this weekend.

Commerce support was based on a Commerce install + commerce_checkout_redirect, but also works without it.
While Commerce 2.x is in active development, i wonder if this is still required, so we might want to implement this at a later time once Commerce is stabilizing a bit beyond where it now is. (it does not block any release anyhow).

The install 'dance' helped a lot of people to get things right from the start, but we might want to rethink it (depending on whats possible now in D8).

Code has been pushed to d.o. and the issue queue is open for issues.

swentel’s picture

Status: Active » Needs work

To clarify, there's still an install hook that sets sensible defaults and the default mail information is now moved to a config file.
That allowed me to remove the code in the test that was setting this up.

The good thing is that the tests are green, so it's to refactor and or add new things if desired :)

Moving to needs work since there's an D8 branch, cool!

MustangGB’s picture

Category: Task » Plan
amh5514’s picture

Hi, I can't get the token [user:registration-password-url] to work. If I activate and test the module by creating a new account, the account is automatically blocked and the verification email I receive is the "Welcome(Awaiting approval)" template. If I try to move the [user:registration-password-url] into this template and save, I get this warning "The Body is using the following invalid tokens: [user:registration-password-url]."

the "who can register" is set to visitor
the "Require e-mail verification when a visitor creates an account" is set to " Require a verification e-mail, but let users set their password directly on the registration form."

I glanced through the module and noticed a dependency on the rpt module ( http://drupal.org/project/rpt ) and I'm not sure if that missing module is the source of the problem

amh5514’s picture

I ran this on a clean install and the same happens except for the invalid token warning.

  • account is blocked
  • "welcome (awaiting approval)" email is sent
  • The token returns nothing

I added the token to the block account and activate account templates and received nothing in the email

This could be a very useful module, hopefully we can get this working soon.

Thanks in advance

gambry’s picture

FileSize
6.35 KB

I made some changes in order for the module to work.
Now I get emails and right messages, although I haven't tested all the scenarios (only Visitors don't need approval + USER_REGISTRATIONPASSWORD_VERIFICATION_PASS) so a more general test is needed.

However the _user_mail_notify() (user.module) has changed:
D7

// By default, we always notify except for canceled and blocked.
  $default_notify = ($op != 'status_canceled' && $op != 'status_blocked');
  $notify = variable_get('user_mail_' . $op . '_notify', $default_notify);
  if ($notify) {...}

D8

// By default, we always notify except for canceled and blocked.
  $notify = \Drupal::config('user.settings')->get('notify.' . $op);
  if ($notify || ($op != 'status_canceled' && $op != 'status_blocked')) {...}

So even setting notify.register_pending_approval to FALSE will send the approval emails to admin anyway. This needs a core change. :(

gambry’s picture

I've opened an issue on the Drupal core queue, let's see if it can be changed from there or if this module should find a different approach on D8.

Rob C’s picture

I've already tried to report this issue, but this has been closed. Couldn't change the title, but didn't forgot about it. #2100111: (possible) regression: can not form_alter and change default_value for 'status' during registration / change user_mail_notify() This was why i never continued my port, would be great if we can get this changed back to something that's usable again. (or we need to duplicate lots of code)

gambry’s picture

Hopefully with the difference described in the issue, the steps to reproduce and the patch to fix it will be more difficult to close without an explanation. Please if you are interested on having this module up and running on D8 subscribe/follow #2765437: _user_mail_notify() always sends emails even if $notify is FALSE.

gambry’s picture

Issue summary: View changes
gambry’s picture

Can anybody following this thread please have a look at #2765437: _user_mail_notify() always sends emails even if $notify is FALSE?
Review/Test it so we can make progress in here too.

Rob C’s picture

Status: Needs work » Fixed

Changes from #9 have been committed. So i think we can close this up. Thanks swentel and gambry!
The first alpha release for Drupal 8 is available here.
Please start issues in the user_registrationpassword issue queue for the Drupal 8 version from now on available here.

Status: Fixed » Closed (fixed)

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