Share » Forums » Developer » Publishing a user profile draft

Publishing a user profile draft

Publishing a user profile draft

Wednesday 25 June 2003 1:17:51 am - 5 replies

Modified on Wednesday 25 June 2003 1:19:37 am by Paul Forsyth

Author Message

Tony Wood

Wednesday 25 June 2003 1:47:50 am

Paul, you do know how much beer costs in Norway! :)

Maybe a trip to duty free on the way over will be a good idea.

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Bård Farstad

Wednesday 25 June 2003 3:00:38 am

Paul, the problem is that you create a new version for every time you post your data. You need to specify the editversion in the URL as well.

eZ publish will automatically create a new version of the object if it's already published, so you shouldn't need to think about this.

Did I just earn myself a beer? ;)

Tony: yes, beer is expensive in Norway. About 50 NOK at a restaurant.

--bård

Documentation: http://ez.no/doc

Paul Forsyth

Wednesday 25 June 2003 3:19:01 am

Hey, food wasn't part of the deal! but, we can bring some walkers thai crisps, lovely!

I still can't get it to publish. I've changed my form line to:

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

to include the current version. When i click through this now i see that a new draft is created, like before. However, also like before pressing the publish button doesn't publish the draft.

Including the current version only seems to aid in creating the new draft but this worked before without this addition...

Are there 'input hidden' fields i need?

Does this have anything to do with the user settings in site.ini?

I should say that my content/edit.tpl doesn't include edit_placement and does include a customised edit_validation routine.

paul

Bård Farstad

Wednesday 25 June 2003 3:33:31 am

Here is a minimal edit template, the MainNodeID is a hidden variable.

<form enctype="multipart/form-data" method="post" action={concat("/content/edit/",$object.id,"/",$edit_version,"/",$edit_language|not|choose(array($edit_language,"/"),''))|ezurl}>
{section show=$validation.processed}
{section name=UnvalidatedAttributes show=$validation.attributes}
<div class="warning">
<h2>Input did not validate</h2>
<ul>
{section loop=$validation.attributes}
<li>{$UnvalidatedAttributes:item.name}: {$UnvalidatedAttributes:item.description}</li>
{/section}
</ul>
</div>

{section-else}

<div class="feedback">
<h2>Input was stored successfully</h2>
</div>

{/section}
{/section}

<input type="hidden" name="MainNodeID" value="{$main_node_id}" />

{section name=ContentObjectAttribute loop=$content_attributes sequence=array(bglight,bgdark)}
<div class="block">
<label>{$ContentObjectAttribute:item.contentclass_attribute.name}:</label><div class="labelbreak"></div>
<input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />
{attribute_edit_gui attribute=$ContentObjectAttribute:item}
</div>
{/section}

<input class="button" type="submit" name="PublishButton" value="Post" />
<input class="button" type="submit" name="DiscardButton" value="Discard" />
</form>

--bård

Documentation: http://ez.no/doc

Paul Forsyth

Wednesday 25 June 2003 4:00:45 am

Got it working :)

In my edit.tpl I am explicitly using elements of the array $content_attributes so that i can display names slightly differently. This means at the end I have lines like:

<input type="hidden" name="ContentObjectAttribute_id[]" value="{$content_attributes[0].id}" />
<input type="hidden" name="ContentObjectAttribute_id[]" value="{$content_attributes[1].id}" />
<input type="hidden" name="ContentObjectAttribute_id[]" value="{$content_attributes[2].id}" />
<input type="hidden" name="ContentObjectAttribute_id[]" value="{$content_attributes[3].id}" />

and so on.

My edit.tpl actually has two forms, intended to submit different parts of the data. The first form submits user account data such as login and password changes. The second submits shop data such as address changes. The user is the same, but i was being selective about what data was passed back to the form so for user data i used the appropriate $content_attribute element and omitted the rest.

Omission of the other $content_attribute causes the draft to not publish...

I guess this means i must submit all attributes to publish... Is this correct? A good error message would be nice :)

Time to refill that hip flask!

thanks

paul

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu