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" ...
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 "...
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, ...
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 '...
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 ...
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 ...
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"...
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" ...
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 ...
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 ...
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;
...
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 ...
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
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
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 ...
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('...
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.
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 ...
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 ...
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 ...
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
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()->...
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
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
user-profile × 99users × 35
form × 12
frontend × 11
plugin-development × 8
registration × 7
usermodel × 7
matrix × 6
password × 6
current-user × 6
craft3 × 5
login × 5
assets × 4
plugin-craftcommerce × 4
control-panel × 4
emails × 4
ajax × 4
templating × 3
validation × 3
assets-field × 3
lightswitch × 3
relations × 2
image-transforms × 2
custom-field × 2
frontend-form × 2