Skip to content

Profile picture uploads fail when using a preparse field in an user #85

@mikesnoeren

Description

@mikesnoeren

I am working on a website where all users have a public profile that is editeable by the user from the front-end.
Because users don't have slugs natively I decided to generate one using a preparse field.

The field contains the following twig code:

{{ (element.fullName ?? element.id)|kebab|ascii }}

And in my code I use the following, which checks if current user belongs to current page.

{% set user_on_this_page = craft.users.userSlug(userSlug ?? currentUser.userSlug).one() %}
{% if not user_on_this_page %}
    {% exit 404 %}
{% endif %}

The code above works fine, but the edit-profile form doesn't.
As long as the preparse field is present I am unable to upload a picture to craft, so users can't change their profile pictures, all other form functionalities work fine..

I've opened a support ticket with Craft and they confirmed the issue is within the preparse field and then asked me to make this bug report.

If needed for debugging, I am willing to send my project file, edit-profile template and composer files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions