Creation context vs Edition context

Author Message

Hakim Bouras

Friday 14 December 2007 8:12:47 am

Hello,

I would like to use the same custom "user edit template" both for the creation and the edition of my users.

From within this "user edit template" how can I detect whether I am in an edition or creation context mode ?

I tried using <i>$object.current.main_parent_node_id</i>, but the problem is if there is a validation round trip (ie: the email entered was not correct) then <i>$object.current.main_parent_node_id</i> is set ...

(Maybe using the URL : user/register vs content/edit ... but how can I check the URL ? maybe there is a smarter way... )

Thank you for your help,
Hakim

Hakim Bouras

Monday 17 December 2007 2:29:45 am

The solution I found is checking <b>$object.current.status</b> which has a value of "5" ("EZ_VERSION_STATUS_INTERNAL_DRAFT") during the creation context as long as the new user is not really created (even during validation round-trip).

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 31 2025 07:26:09
Script start
Timing: Jan 31 2025 07:26:09
Module start 'layout'
Timing: Jan 31 2025 07:26:09
Module start 'content'
Timing: Jan 31 2025 07:26:09
Module end 'content'
Timing: Jan 31 2025 07:26:09
Script end

Main resources:

Total runtime0.0291 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.0056 588.2500151.2266
Module start 'layout' 0.00570.0031 739.476636.6641
Module start 'content' 0.00880.0186 776.140690.1406
Module end 'content' 0.02730.0018 866.281329.9922
Script end 0.0291  896.2734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00258.4598140.0002
Check MTime0.00113.7107140.0001
Mysql Total
Database connection0.00082.762410.0008
Mysqli_queries0.00289.726430.0009
Looping result0.00000.054810.0000
Template Total0.00124.110.0012
Template load0.00093.099510.0009
Template processing0.00031.013010.0003
Override
Cache load0.00062.093010.0006
General
dbfile0.007425.371180.0009
String conversion0.00000.031140.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