Set user preference before first login

Author Message

Olivier Pierret

Wednesday 31 August 2005 5:11:24 am

Hello,

I'd like to be able to set some user preferences before the user logins for the first time.

I'd like the content structure treemenu to be expanded and the preview toggle button to be selected in admin site interface when the users login for the first time. Afterwards, they can do what they want.

I tried to set this through the CachedViewPreferences ini value like this:

[ContentSettings]
CachedViewPreferences[full]=admin_navigation_content=1;admin_navigation_details=0;admin_navigation_languages=0;admin_navigation_locations=0;admin_navigation_relations=0;admin_navigation_roles=0;admin_navigation_policies=0;admin_navigation_content=0;admin_navigation_translations=0;admin_children_viewmode=list;admin_list_limit=1;admin_edit_show_locations=0;admin_leftmenu_width=10;admin_url_list_limit=10;admin_url_view_limit=10;admin_section_list_limit=1;admin_orderlist_sortfield=user_name;admin_orderlist_sortorder=desc;admin_search_stats_limit=1;admin_treemenu=1;admin_bookmarkmenu=1;admin_left_menu_width=13


but it failed (ez seems not to take care of these default preference values).

Could someone tell me
1) if I use the right method to achieve this ?
2) how to find what is wrong ?

Many thanks

Olivier

Kristof Coomans

Thursday 01 September 2005 12:29:00 am

The defaults in the CachedViewPreferences setting are only used for view caching.

The best way to accomplish this is to write a little post publish workflow event type, that sets the default preferences for a user object. You can put the preference/default value pairs in an INI file, or provide an interface in your event type to store them in the workflow event.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Olivier Pierret

Thursday 01 September 2005 1:08:36 am

After one night thinking about this I came to the same conlusion: I will do it using post publish triggered workflow event.

You conforted me this is the right design

Thanks for your help

Kristof Coomans

Thursday 01 September 2005 1:46:44 am

Can you add this workflow event type to the contributions when it's ready?

Thanks!

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Olivier Pierret

Thursday 01 September 2005 1:18:51 pm

Unfortunately I cannot make a contribution with this, I have integrated this change in a very specific extension that is useful only for our customer.

However, I can tell you it works. Just put the following line in the processEvent function:

eZPreferences:setValue('admin_treemenu','1',$objectID);

I use this in conjunction with the importXmlData contrib (http://ez.no/community/contribs/import_export/import_xml_data)
I import the users from a big xml file and a workflow is triggered on each user created in the ez systems. It allows me to set the correct preferences and access rights on the created users. Now, you know everything ;)

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 06:08:18
Script start
Timing: Jan 19 2025 06:08:18
Module start 'layout'
Timing: Jan 19 2025 06:08:18
Module start 'content'
Timing: Jan 19 2025 06:08:19
Module end 'content'
Timing: Jan 19 2025 06:08:19
Script end

Main resources:

Total runtime1.0689 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 589.2734152.6406
Module start 'layout' 0.00530.0031 741.914139.4766
Module start 'content' 0.00851.0587 781.3906561.1719
Module end 'content' 1.06710.0017 1,342.562512.1406
Script end 1.0689  1,354.7031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3428160.0002
Check MTime0.00140.1263160.0001
Mysql Total
Database connection0.00050.050210.0005
Mysqli_queries1.009694.4512630.0160
Looping result0.00090.0860610.0000
Template Total1.009794.520.5049
Template load0.00300.282320.0015
Template processing1.006794.178120.5033
Template load and register function0.00020.017910.0002
states
state_id_array0.00210.198410.0021
state_identifier_array0.00150.140720.0008
Override
Cache load0.00260.2460340.0001
Sytem overhead
Fetch class attribute can translate value0.00050.045120.0002
Fetch class attribute name0.00080.077760.0001
XML
Image XML parsing0.00060.058920.0003
class_abstraction
Instantiating content class attribute0.00000.001570.0000
General
dbfile0.00180.1686160.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs