Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.
16 votes
Accepted

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

Before you can allow a user to manage their profile photo in your front-end profile edit form, be sure to update your form tag with the enctype="multipart/form-data" parameter: <form method="post" ...
user avatar
  • 13.2k
15 votes
Accepted

Change the size of a users profile photo?

I found the answer on the Craft website under the UserModel section: getPhotoUrl( size ) Returns a URL to the user’s photo at a given size in pixels (defaults to 100). You can also pass in "...
user avatar
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, ...
user avatar
  • 4,509
10 votes

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

If you want a user to be able to upload a profile photo from the front-end, the you should be able to add enctype="multipart/form-data" to your form that saves your user and have a file input called '...
user avatar
  • 66.4k
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 ...
user avatar
  • 23.6k
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 ...
user avatar
  • 1,623
7 votes

User Profile Not Saving Changes

firstName, lastName, and email are actual user fields (not custom), so their name= attributes shouldn’t have the fields[] namespace. <input type="email" class="form-control" id="email" name="email"...
user avatar
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" ...
user avatar
  • 66.4k
5 votes

What's the best way to create public profile and content forms?

User registration works just like front-end entry editing. You build the form on any page you like, and submit it to the action "users/saveUser". All fields need to be coded by you, and extra profile ...
user avatar
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 ...
user avatar
  • 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; ...
user avatar
  • 1,818
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 ...
user avatar
  • 10.9k
4 votes
Accepted

How do I tell Craft not to automatically crop user profile images?

You could add a custom asset field for the users' profile images and hide the default one in the CP. Here's a plugin to do this: Control Panel CSS by Lindsey D
user avatar
  • 35.8k
4 votes
Accepted

Change the location of the user photos

You could add a custom asset field for the users' profile images and hide the default one in the CP. Here's a plugin to do this: Control Panel CSS by Lindsey D
user avatar
  • 35.8k
4 votes

Using a user’s full name in the URL

Marcus, I think you can use anything as an url for a user's page. In your case, I'd make a dynamic route like: user/* and assign it a template, for instance: user/_entry Within that template, all ...
user avatar
  • 6,288
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('...
user avatar
  • 2,947
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.
user avatar
  • 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 ...
user avatar
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 ...
user avatar
  • 66.4k
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 ...
user avatar
  • 66.4k
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 ...
user avatar
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 ...
user avatar
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 ...
user avatar
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 ...
user avatar
  • 854
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 ...
user avatar
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()->...
user avatar
  • 66.4k
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 ...
user avatar
3 votes

How do I tell Craft not to automatically crop user profile images?

Maybe not the answer you are looking for, but I asked a similar question. I needed to grab the original size of the user uploaded images. Change the size of a users profile photo? You can just use ...
user avatar
3 votes
Accepted

Change user password on the front end

Currently the users/saveUser (and the deprecated users/setPassword) controller action doesn’t support Ajax requests, so there won’t really be an easy way to tell if it worked or not. If you really ...
user avatar
3 votes

Prevent change field in user profile edit

There isn't anything to do this out-of-the-box in Craft. I believe the proper way you'd want to approach it would be to write a plugin that has it's own field type that takes into account user ...
user avatar
  • 66.4k

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