Skip to main content
7 votes

How do you set a user's group on a registration form?

If you're looking for a Craft 3 solution, I just got this set up on a project and hope it helps someone else out. First you'll need to add a custom field to your form. If you want your user to ...
Ryan's user avatar
  • 1,962
5 votes
Accepted

Registration into default group is not working as expected

I get bit by this a lot. Just like @Stephen Lewis suggested - make sure you are not logged into the same browser. For example, log into the CP with Safari (or whatever) and then use Chrome to ...
Damon's user avatar
  • 4,706
5 votes
Accepted

Save and login user in a Plugin?

Put this at the top of the file: use craft\elements\User; Within your function use the following code: $user = new User(); $user->pending = true; $user->username = $contact["login_email"]; $...
Matt Shearing's user avatar
4 votes
Accepted

Send activation mail from front end

I'll focus on the "sending an activation email from the front end" part of your question, since that seems to be the crux of it: You'd have to write a very simple, custom plugin. For instant success, ...
Mats Mikkel Rummelhoff's user avatar
4 votes
Accepted

Send email to website owner after user registration

I have done something very similar. You'll want to create a plugin for this. In my case, I am validating email addresses so I was checking against the onBeforeActivateUser event. If you are not ...
Damon's user avatar
  • 4,706
4 votes

User registration form with checkbox field

Just in case anyone else has this issue i got it working with these modifications. I think the hidden field was required for the possibility of null values. <input type="hidden" name="fields[...
Matt B's user avatar
  • 73
3 votes

Register a user as part of a Commerce checkout?

Luke's answer above is absolutely right and the simplest approach, but as I commented above, I wrote a plugin for this: https://github.com/bossanova808/CommerceRegisterOnCheckout ..the reason being ...
Jeremy Daalder's user avatar
3 votes
Accepted

Custom registration User validation

It looks like you're not returning the user model back to the template. You need something like this in your controller. craft()->urlManager->setRouteVariables(array( 'account' => $user ...
Jamie Pittock's user avatar
3 votes
Accepted

Front-end registration validation

You could use Regex (Regular Expression), /^[a-zA-Z]{3,}$/ would for instance allow a minimum of 3 characters behind the comma would be the max value. As for numbers it would be something like this /^...
Bram B's user avatar
  • 353
3 votes
Accepted

Custom login/profile sections?

Its not at all difficult. Here's the example form from the docs: https://craftcms.com/docs/templating/user-registration-form <form method="post" accept-charset="UTF-8"> {{ getCsrfInput() }}...
Amit Erandole's user avatar
3 votes
Accepted

Auto-login on account activation

(Not necessarily a great answer to your question, but it's in the same wheelhouse and might be handy if you're working in this area)! I remember having issues with this myself (to be honest the ...
Jeremy Daalder's user avatar
3 votes

Autologin destination

Okay - got to the bottom of this. Was using the wrong setting. Should have been setPasswordSuccessPath not setPasswordSuccess!
Cole Henley's user avatar
  • 1,741
3 votes
Accepted

Unverified emails blocking user registration

I'm not sure that I agree with your analysis. At a minimum maybe it's a feature request with a config setting to change the behavior. But if you're really concerned about the behavior, you can ...
Brad Bell's user avatar
  • 67.5k
3 votes
Accepted

AJAX Front-end User Registration Form not displaying macro errorList

No errors are displayed because you are using AJAX to post your data. The errorList function works only with "regular" POST flow. When ajax response is available you need to grab it and append errors ...
Krzysztof Boduch's user avatar
3 votes
Accepted

How to get the original entered password value on registration form error?

You could always use the Craft request object to repopulate the fields, however I don't think it's common practice to repopulate password fields for security reasons. Another thing that is considered ...
Andris Sevcenko's user avatar
3 votes
Accepted

Autologin after frontend registration

Oh my god I lost half the day on a syntax error !! My general.php file had the line with true in quotes : 'autoLoginAfterAccountActivation' => 'true', The correct line to have the parameter work ...
migmaker's user avatar
  • 972
3 votes
Accepted

Detect if it is a new user or not in PHP

In Craft 3 you would do: Event::on( Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, function(Event $event) { if ($event->element instanceof \craft\elements\User &&...
Oli's user avatar
  • 7,495
3 votes
Accepted

how to check if a user email exists before creating a new user on a frontend form?

There are ways to check the email as soon as it's entered, but it's a bit more involved. The built-in controller action to create new users already does this check for you, so you should see if you ...
MoritzLost's user avatar
  • 11.6k
2 votes
Accepted

Update user password

You can't use the users.onBeforeSaveUser event to set a user's password as this event happens after the supplied password has been hashed by a private method in the UsersService. Instead, you could ...
Steve Rowling's user avatar
2 votes
Accepted

The difference between username and loginName

Because you can login with either your email address or your username. And some sites will be forcing the username to be the email address.
Brad Bell's user avatar
  • 67.5k
2 votes
Accepted

Does Craft Commerce support One Time Password and Social Login features?

Craft Pro gives you the ability to add multiple user accounts to your site. Craft Commerce is a plugin that extends Craft so user accounts and everything that goes with them are available to use. ...
Luke Pearce's user avatar
  • 3,863
2 votes

Send activation mail from front end

Since this is on the front-end of a site, you can create a plugin that mimics as much of or as little of the default Craft user registration workflow as you want in UsersController and possibly ...
Brad Bell's user avatar
  • 67.5k
2 votes

Auto-login on account activation

Add 'autoLoginAfterAccountActivation' => true to config/general.php Link: https://craftcms.com/docs/3.x/config/config-settings.html#autologinafteraccountactivation
Jessica Talzor's user avatar
2 votes
Accepted

Don't allow multiple users with same the password

This is not a common practice out of the box, and not even desirable as you may also imply that other users have the same password creating the possibility for this new user to just try different ...
Gui Rams's user avatar
  • 106
2 votes

Craft - suitability for membership/user registration and document upload/management

Should be no problem, Craft has extensive user management capabilities, check https://craftcms.com/features/users & https://craftcms.com/docs/users as well as solid asset management https://...
erwinheiser's user avatar
2 votes

How to implement radiobuttons field on frontend registration form?

Because radio inputs are a "single value field", meaning that when the form submits, only one value actually goes through, you don't need the extra [] array brackets at the end of each fields[] array. ...
Ryan's user avatar
  • 1,962
2 votes
Accepted

Password validation for resetting password

I wasn't validating againts the field newPassword, only validating against password. Hence why I wasn't getting any feedback. Duplicating the validation for newPassword seems to have resolved this.
Terry Upton's user avatar
  • 1,894
2 votes

Problem with user activation links

Just to add; we are apparently seeing this issue too. Or to be more clear: we haven't seen it ourselves, but our client keeps getting reports from their customers that Activation links are not working ...
Matt Wilcox's user avatar
  • 3,209
2 votes
Accepted

Register a user as part of a Commerce checkout?

To create an account for a Commerce customer you'd use the exact same method as registering a Craft user via the front-end. The only difference would be that you may already have some of their details....
Luke Pearce's user avatar
  • 3,863
2 votes

Send email to website owner after user registration

I don't think a plugin is available to do this specifically but you could write your own plugin and listen to the onAssignUserToDefaultGroup event and send an e-mail from there in your plugin. ...
Rias's user avatar
  • 171

Only top scored, non community-wiki answers of a minimum length are eligible