Update other users profile from frontend

Hello, I’m loading other users profiles using Profile snippet and any ID, eg:

[[!Profile?
    &user=`5`
]]

in a form using simple inputs with placeholders I’m displaying the user details:

<input type="text" name="fullname" value="[[!+fullname]]" />

That is working fine!
Now I need to modify and update those details, for that I’m trying to use UpdateProfile snippet, reading other posts in theory it should work if I use the &user property with the same ID, like in this ModX post:

[[!UpdateProfile?
    &user=`5`
]]

That one is not working!!!. :unamused:
But checking the UpdateProfile documentation there is nothing about the &user property.

So the question here is: It has been removed or how can I make this work?
Any help will be welcome, thanks!

the &user property hasn’t been removed. Your code should work.

Maybe it’s a permissions issue.

I’m testing with my admin sudo user.
There are permissions in the resource, I just remove them but nothing works.
Any idea? Thanks!

I did a test with MODX 2.8.3, Login 1.9.9 and this template (part of the form from here):

[[!UpdateProfile? &user=`5`]]

<div class="update-profile">
    <div class="updprof-error">[[+error.message]]</div>
    [[+login.update_success:is=`1`:then=`[[%login.profile_updated? &namespace=`login` &topic=`updateprofile`]]`]]

    <form class="form" action="[[~[[*id]]]]" method="post">
        <input type="hidden" name="nospam" value="" />

        <label for="fullname">[[!%login.fullname? &namespace=`login` &topic=`updateprofile`]]
            <span class="error">[[+error.fullname]]</span>
        </label>
        <input type="text" name="fullname" id="fullname" value="[[+fullname]]" />

        <label for="email">[[!%login.email]]
            <span class="error">[[+error.email]]</span>
        </label>
        <input type="text" name="email" id="email" value="[[+email]]" />

        <div class="form-buttons">
            <input type="submit" name="login-updprof-btn" value="[[!%login.update_profile]]" />
        </div>
    </form>
</div>

When I’m logged in on the frontend as admin, I can update “Full name” and “Email address” for the user with the ID 5.

When you load the page, does it create an error message in the log “Could not find user: 5”?

1 Like

Hello @halftrainedharry .
Mate, there was no errors, but thanks to your code I realise the problem was another snippet somewhere and I solved the problem.
And I realise the snippet Profile wasn’t necessary!
I really appreciate your guide, Thank you very much for your help!