14 votes
Accepted

Updating a Lightswitch value not working via front-end

After taking a look at this it would seem like the lightswitch is always expecting a value to determine the whether the state should be on or off. When you don’t check the input and submit the form, ...
  • 4,519
9 votes
Accepted

What's the difference between 'user', 'currentUser', and 'account'?

Update: As of Craft 3.x, the deprecated user variable no longer works. Make sure to use the proper currentUser variable instead! Original: user and currentUser are exactly the same. They contain the ...
  • 23.7k
9 votes
Accepted

Updating a user on the front end with Vue.js and Axios

Unlike Vue Resourse (if you've used it), Axios does not have a good way to emulateJSON on legacy servers or frameworks that do not understand submissions sent as application/json. Your data gets to ...
  • 1,623
6 votes
Accepted

How does Craft regard a Lightswitch field when it's set to Required in the Fields layout?

Currently it has no affect on the Lightswitch field at all, which I think is the right call. However, you do have a valid use-case for either making a setting on the field that forced it to be "on" ...
  • 66.7k
5 votes

How to add addition attribute and fields in public registration form in Craft CMS

Before you can allow any type of user groups you will need at a minimum of the Client version of Craft. To allow public registration, you will need the Professional version. Only the Professional ...
  • 4,696
5 votes
Accepted

How would I show a message and define where the user is redirected after changing their email through a front end form?

Based on Brad's response I created the following controller in a plugin: <?php namespace Craft; class Myplugin_SaveUserController extends BaseController { protected $allowAnonymous = true; ...
  • 1,828
4 votes

Save user profile fields through plugin

You use setContentFromPost method on the UserModel if you are posting to your plugin, like so (this is what happens when you save your profile in the control panel): $user->setContentFromPost('...
  • 2,957
4 votes

Allow user to change or delete their photo for their profile from the front end

FWIW, Niall, I've always just created an additional Profile field for people's images. The weird "not really an asset" aspect of the profile pictures is gone in Craft 3, but I found enough annoyances ...
  • 11.2k
4 votes
Accepted

Activate account email {{link}}

OK, just did a quick look through the docs. Appears that this can be set via the config file. Link to documentation There's also the option to set whether the user is logged in automatically.
  • 438
4 votes
Accepted

How do I update the state of lightswitches reliably using checkboxes on a frontend user profile form?

While both lightswitches and checkboxes represent an on/off state, they are quite different. Standard browser behavior is designed to only post checkbox data if the checkbox is checked, otherwise it ...
4 votes
Accepted

Allow users to change email address on front-end form

When I use my email field to attempt an email address change, I get a verification email generated by Craft sent to the new email address, but the email change is not reflected in either the CP or on ...
  • 66.7k
4 votes

How would I show a message and define where the user is redirected after changing their email through a front end form?

In Craft when changing an email address (even if it's the currently logged in user), they must supply their existing password as well. You can use the hidden redirect input to send to whatever ...
  • 66.7k
4 votes
Accepted

How do I relate a user to a channel entry from a form?

When saving an entry field type as part of your plug-in it needs to be an array of IDs in order to work correctly. This can either be handled via a plug-in or in the form by passing the value as an ...
4 votes
Accepted

get post data after submitting User Profile Form for success message

Not possible – any input values added to your profile editing form (such as test in your case) will be included in the POST request to the users/saveUser controller action, but they won't actually be ...
4 votes
Accepted

Delete a relation in frontend form

I believe you're getting that error because you're supplying an array ([]) for the mother field and the only value in that array would be an empty string ("") if they select the There is no mother ...
4 votes

Change email address on front end

Thanks to billythekid's suggestion, adding a password field creates an elevated session, and solves my problem. <input type="password" name="password" placeholder="Password" required> Actually ...
  • 884
4 votes
Accepted

Commerce: How to implement/save 'Use shipping for billing' field for future orders

We achieve this by simply checking the ids of the addresses set on the cart. Commerce saves the last used shipping and billing address for customers, so you can just use some simple template logic to ...
3 votes

Update User Profile with Plugin

I'm not sure if this is causing your error, but it's recommended to use setContentFromPost() or getContent()->setAttributes() so that craft has a chance to prep the field values, as discussed in this ...
3 votes

How to pull extra data with a user

You can add custom fields to users the same way as you do for entries, categories, and all other elements in Craft. Create a custom field for middle name, and go to Settings > Users > Fields and add ...
  • 7,258
3 votes

Looking for a private commenting solution for member area

Something like this should work, but keep in mind there are lot's of ways to accomplish this. Without knowing your requirements, I'll assume you want an index page of assets, that link to an asset ...
3 votes
Accepted

Saving user profile photos to S3

Craft 3 Update This is currently possible in Craft 3. Install the AWS S3 plugin from the Plugin Store. Make sure you're running Craft Pro. Create a new Asset Volume using S3. Go to Settings->Users-...
  • 66.7k
3 votes
Accepted

How can you check if "public user registration" is turned on or off on the front-end?

You can write a plugin that has a Template Variable that exposes Craft's SystemSettingsService->getSettings() method like so: public function isPublicRegistrationEnabled() { return craft()->...
  • 66.7k
3 votes

Required fields in the user profile

For custom fields that you add to users under settings>users>fields, you can control whether the field is required by clicking on the small gear icon and selecting make required. With built-in ...
3 votes
Accepted

Remove username from photoUrl path

Since I use email addresses as usernames, I don’t think it’s a good idea to expose the email addresses of all users on the web. I agree, and that's something we overlooked when we added the '...
  • 66.7k
3 votes

User Profile Not Saving Changes

It should also be noted that to change your password or email, the current password has to be passed along with the request. // You must pass your current password to change these fields for an ...
3 votes

Using Form to update User Profile and submit form

Yep, that's totally do-able. Check out this article to see how to create a registration form. Then check out this article to see how to create the update profile form. The thing to note is that any ...
  • 4,696
3 votes
Accepted

What is the least intrusive way to allow a user to change their email address on the front-end?

On the front-end of the site, if you're going through Craft's UsersController->actionSaveUser(), then you're correct... we do require the current user's existing password to create an elevated session ...
  • 66.7k
3 votes
Accepted

Edit user's first and last name

A User's first and last name fields don't need the fields[] prefix as they aren't custom fields added to the user field group. So using the following should work: <label for="voornaam">{{"...
  • 3,833
3 votes

Bad Request POST param “redirect” was invalid

UPDATE and final answer: The culprit was having the general config setting validateUnsafeRequestParams => true and not having my redirect value hashed ({{ 'account/profile' | hash }}). I had ...
3 votes
Accepted

Asset dynamic subfolder for User Matrix

You should be using {{currentUser.id}} instead of {currentUser.id} The difference is that double curly brace syntax works on the global scope, while single curly brace syntax tries to resolve itself ...

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