Forums / Setup & design / /user/edit doesn't work

/user/edit doesn't work

Author Message

Willie Seabrook

Sunday 31 August 2003 9:31:22 pm

Hi,

I have modified all the user login/register bits etc but i want to allow my users to edit their information easily. However, going to user/edit simply returns an error:

"Unavailable:
Content unavailable"

What is the story with this? How can I allow my users to edit their details but nothing else?

Regards,
Willie

Paul Forsyth

Monday 01 September 2003 12:22:51 am

I have problems editing the user that way. It is the best way, programmatically. The code seems to fail when it checks whether the user can be edited when given the correct user id (user/edit/80, for example).

I get better results by editing the content object directly, as a user is simply a content object. This code gives you an idea how to do this from a form in a template. Sometimes the variable $current_user is set in your current namespace. If not you can fetch it as I have shown. Note, you can test this just by typing a url directly into your browser... :)

{let current_user=fetch('user','current_user')}

<form name="MyForm" method="post" action="{concat('/content/edit/', $current_user.contentobject_id,'/')}">

<input type="submit" name="NewButton" value="Edit user"/>

</form>

Paul

Paul Forsyth

Monday 01 September 2003 12:26:41 am

Note, you need to make sure your user role is able to self edit their own details for this to work. Also, 3.2 has some bug fixes in it to make this work...

Paul

Willie Seabrook

Tuesday 02 September 2003 2:34:31 pm

Do you mean that 3.2 has some fixes in it to make *your* code work or to make the *user/edit* code work?

3.2 Is quite useless to me at the moment because the 3.1 to 3.2 database upgrade sql doesn't work - hence I'm stuck on 3.1.

Regards,
Willie

Paul Forsyth

Wednesday 03 September 2003 12:19:02 am

We saw a comment in svn commit logs a while ago about something in 3.2 that helps to fix this but to be honest im not 100% sure. I just know it seems to work... but we haven't heavily tested yet.

This thread speaks about what we did for 3.1 to get it all to work. There is a small patch in there you can apply.

http://ez.no/developer/ez_publish_3/forum/developer/allowing_users_to_edit_their_own_details_with_selfedit_how_does_it_work

Paul