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
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
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

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
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

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.6k
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.6k
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,515
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.6k
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,796
1 vote
Accepted

User data segregation for multi-sites in Craft 3?

Craft 3 multi-site is an extension of locales in Craft 2, so how the data is stored is virtually identical. The difference is that locales in Craft 2 are tied to language/country codes, but sites in ...
Brad Bell's user avatar
  • 67.6k
1 vote
Accepted

How would I create unique fields for different user groups programmatically?

You could control which fields a user has access to based on their group from a front end edit profile page, but there is no way to do this in the admin outside of creating a plugin with a custom ...
Rick Kukiela's user avatar
1 vote
Accepted

Conditional to see if an Entries field in a user profile contains a certain entry ID

I don't think contains will behave like you expect (since booksField will return an array of objects and your checking that against an integer id). Not the prettiest, but something like this should ...
Brad Bell's user avatar
  • 67.6k
1 vote

Conditional to see if an Entries field in a user profile contains a certain entry ID

My initial though was that you do not need to not put the "entry.id" in quotes because it's a variable reference, but the contains() method appear to not work as expected here even when this was ...
Isaac Raway'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.6k
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
1 vote

Why does {{ user.getPhotoUrl(64) }} point towards storage/runtime and not to storage/userprofiles?

@cole sorted it! I am hosting craft locally and my localhost used the port number as part of it's URL. I switched the ports to 80/81/3306 which took the 8888 port out of the url and also loaded all ...
Remco's user avatar
  • 143
1 vote

Why does {{ user.getPhotoUrl(64) }} point towards storage/runtime and not to storage/userprofiles?

I don't think the /Applications/MAMP/htdocs/craft/storage/runtime/assets/sources/ log entries are related to the request when getResourceUrl() is called. Of if they are, they are elsewhere in the ...
Brad Bell's user avatar
  • 67.6k
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.6k
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

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