Forums / Setup & design / Set user preference before first login

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 ;)