Skip to main content
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 ...
Selvin Ortiz's user avatar
  • 1,623
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 ...
Ian Ebden's user avatar
  • 894
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 ...
Stephen Hamilton's user avatar
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 ...
andrew.welch's user avatar
  • 11.6k
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 ...
Mats Mikkel Rummelhoff's user avatar
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 ...
Jeremy Daalder's user avatar
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">{{"...
Luke Pearce's user avatar
  • 3,863
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 ...
Brad Bell's user avatar
  • 67.5k
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 ...
John Johnson's user avatar
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 ...
Andris Sevcenko's user avatar
2 votes
Accepted

User Profile Not Saving Changes

You need to define the value= attribute on your select fields. <select class="form-control margin-bottom" id="renting" name="fields[renting]"> {% for option in user.renting.options %} <...
tosegard's user avatar
2 votes
Accepted

How can I check a user has completed a field in their profile after log in?

If you have a front end form for user registration then you should mark the fields as required in the CMS, you can then make use of Crafts form validation. I had a project where we imported user ...
Luke Pearce's user avatar
  • 3,863
2 votes
Accepted

How can I access the raw profile photo for any given user?

As you've discovered, you can get the full cropped version of the image with author.getPhotoUrl('original'), but Craft doesn't keep a copy of the original un-cropped version of the image around. And ...
Brad Bell's user avatar
  • 67.5k
2 votes
Accepted

Save the form if not complete and come back another time to complete the form

The FormBuilder plugin has no option to edit a submitted form. I think the best way is to use a channel in Craft CMS and write your own form. You can find the documentation on how to create/edit ...
Tom Bauer's user avatar
  • 1,327
2 votes
Accepted

Route to User page from first segment

You could add a check at the top of all of your templates that tests if the first uri segment matches one the agent names. {% set firstSegment = craft.request.firstSegment %} {% set agents = craft....
Douglas McDonald's user avatar
2 votes

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

I have it working like this: First set axios defaults to window.axios.defaults.headers.common = { 'X-Requested-With': 'XMLHttpRequest' }; Then in your component I use URLSearchParams() to ...
Vadim Goncharov's user avatar
2 votes
Accepted

User Order History Not showing Up in CP

The Order History is the history of that particular order and not designed to pull in other prior orders from that customer. You might want to make a feature request if you want to be able to see ...
Jeremy Daalder's user avatar
2 votes
Accepted

Variable for User Field

You could try using the attribute function in twig, this should let you call dynamic properties. Something like: {{ attribute(currentUser, question.fieldName) }}
Alec Ritson's user avatar
  • 4,539
2 votes

Why are my profile pages not generating which I click on 'submit'?

Try setting the action and redirect as hidden inputs, see below: <form method="post"> <input type="hidden" name="action" value="users/saveUser"> <input type="hidden" name="...
Brad's user avatar
  • 487
2 votes

you cannot access the CP with that account

If a user gets that message when logging in, then it means they haven't been assigned the "Access the CP" permissions in the Control Panel, either directly or through a User Group that they belong to.
Brad Bell's user avatar
  • 67.5k
2 votes

Site with public profile pages

Yes craft provides many tools that allows public registration and editing the profiles without a single line of php or even a plugin. Most functions are covered by the cms and even custom functions ...
Robin Schambach's user avatar
2 votes

User Account Form Dropdown

You need to check the currentUser country if it's the same as the option value -> select the option <option {{ currentUser.country.value == option.value? 'selected' : '' }} value="{{ option.value ...
Robin Schambach's user avatar
2 votes
Accepted

Trying to show selected categories in a multi select form input

When you do currentUser.occupation.all() your selected variable is an objet so your conditional {% if category.id == selected %} will never pass as you are checking if category.id equals an object. ...
Oli's user avatar
  • 7,495
2 votes
Accepted

Displaying Craft User Profile based on First and Last Name

See: https://docs.craftcms.com/v3/dev/element-queries/user-queries.html#lastname {% set slug = 'first-last'|split('-') %} {% set firstNameSlug = slug[0] %} {% set lastNameSlug = slug[1] %} {% set ...
Clark Nelson's user avatar
2 votes
Accepted

Do i need a [ Craft PRO ] to create accounts/User management for my LMS website?

If you want multiple user accounts in Craft, then you'd need Craft Pro, regardless of the type of site you're trying to building on the front-end.
Brad Bell's user avatar
  • 67.5k
2 votes
Accepted

Backend Save user fields

As of Craft 3.7.21, this can be done as follows. $user->name = 'New Name'; Craft::$app->elements->saveElement($user, false); Prior to Craft 3.7.21, it was necessary to call setFieldValue. $...
Ben Croker's user avatar
  • 7,631
1 vote

Authentication by a custom field

A possible workaround would be to use the phone numbers as the username. Then you could write a Craft plugin that listened to the onBeforeLogin event and validated the entered phonenumber against ...
Brad Bell's user avatar
  • 67.5k
1 vote

Authentication by a custom field

The short answer is no. Craft does not natively support this, and there's no way to implement it via a hook (or event). A quick browse through the code shows that the UserIdentity::authenticate ...
Stephen Lewis's user avatar
1 vote

limiting profiles to user groups

Custom fields are attached to Users, not User Groups. Seems like you'd be able to do what you want on the template side, though. i.e. something like "if user is in group A, show field B, otherwise ...
Brad Bell's user avatar
  • 67.5k
1 vote

Checkbox profile fields front end show labels in cp

This is the expected behaviour. It makes perfect sense to display the human-friendly checkbox label on an admin screen, rather than the (potentially obtuse) checkbox value. To confirm that this isn't ...
Stephen Lewis's user avatar

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