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.

eZ debug

Timing: Jan 19 2025 19:00:47
Script start
Timing: Jan 19 2025 19:00:47
Module start 'layout'
Timing: Jan 19 2025 19:00:47
Module start 'content'
Timing: Jan 19 2025 19:00:47
Module end 'content'
Timing: Jan 19 2025 19:00:47
Script end

Main resources:

Total runtime0.0183 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 589.1563152.6250
Module start 'layout' 0.00590.0032 741.781339.4609
Module start 'content' 0.00910.0072 781.242289.3047
Module end 'content' 0.01630.0020 870.546934.3047
Script end 0.0183  904.8516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002513.6815140.0002
Check MTime0.00115.7537140.0001
Mysql Total
Database connection0.00073.796810.0007
Mysqli_queries0.003519.136130.0012
Looping result0.00000.059810.0000
Template Total0.00158.410.0015
Template load0.00094.826610.0009
Template processing0.00073.566610.0007
Override
Cache load0.00063.261110.0006
General
dbfile0.002111.601080.0003
String conversion0.00000.042940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs