Edit only one attribute of an object

Author Message

David Zaoui

Monday 04 June 2007 5:48:40 am

Hi everybody,

Here's my problem :

I have created a custom user class. I overrided edit.tpl and edit_attribute.tpl in order to be able edit a user directly via the front office website.
But now i want to make a "user preferences" page where users can only change one of their attributes ( the others must not be shown).

I tried to create a frontpage, then override it and put this code into :

<form enctype="multipart/form-data" id="editform" method="post" action={concat("/content/edit/",$user.contentobject.id"/",$edit_version,"/",$edit_language|not|choose(concat($edit_language,"/"),''))|ezurl}>

{def $user=fetch('user','current_user')}
<div class="block">
<input type="hidden" name="{$user.contentobject.data_map.id_bloc_1.contentclass_attribute_name}" value="{$user.contentobject.data_map.id_bloc_1.contentclassattribute_id}" />
{attribute_edit_gui attribute=$user.contentobject.data_map.id_bloc_1 view_parameters=$view_parameters}

</div>

<input type="hidden" name="ContentObjectID" value="{$user.contentobject_id}" />
<input type="hidden" name="ContentNodeID" value="{$user.object.main_node_id}" />
<input class="button" type="submit" name="PublishButton" value="Update" />
</form>

So when i open the page, i have an input where the actual value of the attribute "id_bloc_1" is shown. But when i type a new value instead and then click on the publish button, nothing happends (the value of the attributes stays the same).

Have you got any idea of how correctly update this value?

Thanks for your answers

Andreas Adelsberger

Monday 04 June 2007 6:23:12 am

hi there, you should use this one

http://ez.no/community/contribs/hacks/attributeedit_policy

otherwise it is not very secure using just modified templates, it works great for me!

greetz andi

---------------------------------------
Styleflasher New Media OG
Websites. Games/Multimedia.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.