Finding draft for a specific anonymous user

Author Message

Atle Pedersen

Thursday 03 May 2007 8:17:17 am

I'm working on a site where anonymous users can post new objects. However, I need them to be able to browse the site, and come back to editing the object later.

In order to do that, I figure I should store the object id in a preferences or session variable. I cannot just fetch the drafts, since there is no way I can discriminate between which draft belongs to which of the anonymous users on the system.

So I've made myself a new extension with a new operator doing this:

                $db->begin();
                eZPreferences::setValue( $namedParameters['name'] ,(string)$namedParameters['value']);
                $db->commit();

It almost works, but just almost. Sometimes the variable is set as I want it to. Sometimes it is not set. It works better on some machines and browsers than on other. On some it works almost all of the time. On others just occasionally.

I've tried adding

                eZPreferences::storeInSession( $namedParameters['name'] ,(string)$namedParameters['value']);

But it makes no difference. Neither does this work with session variables.

Using /user/preferences/set/ works very well all of the time.

What am I doing wrong? Is there a simpler way of doing what I want to do?

Atle Pedersen

Friday 04 May 2007 12:52:02 am

Additional question:

When 'logged on' as anonymous, is there any practical differences between setting a preference variable (which only belongs to the given session) and setting a session variable?

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 00:33:39
Script start
Timing: Jan 19 2025 00:33:39
Module start 'layout'
Timing: Jan 19 2025 00:33:39
Module start 'content'
Timing: Jan 19 2025 00:33:39
Module end 'content'
Timing: Jan 19 2025 00:33:39
Script end

Main resources:

Total runtime0.0150 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.0051 588.0469152.6406
Module start 'layout' 0.00510.0030 740.687539.4766
Module start 'content' 0.00810.0048 780.164189.4922
Module end 'content' 0.01280.0021 869.656330.3047
Script end 0.0149  899.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002415.9736140.0002
Check MTime0.00117.2829140.0001
Mysql Total
Database connection0.00074.697710.0007
Mysqli_queries0.002818.534830.0009
Looping result0.00000.227510.0000
Template Total0.001611.010.0016
Template load0.00095.970410.0009
Template processing0.00085.004810.0008
Override
Cache load0.00053.603210.0005
General
dbfile0.00021.517780.0000
String conversion0.00000.046140.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