Fetch list of users

Author Message

GDA AS

Monday 06 March 2006 12:20:37 am

How can I fetch a list of all users or one specific user object other than the current user?

In the socumentation I can only find the following fetch functions, none of them seems to do what I'm looking for.

user
Name Summary
anonymous_count Fetches the number of anonymous users.
current_user Fetches the user that is currently logged in.
has_access_to Checks if a user has access to a certain function of a module.
is_logged_in Checks if a specific user is logged in.
logged_in_count Fetches the number of users that are logged in.
logged_in_list Fetches the names of the users that are logged in.
logged_in_users Fetches the users that are logged in.
member_of Fetches the roles that are assigned to a user.
user_role Fetches the policies that are available for a user.

Patrice DUCLAUD

Monday 06 March 2006 12:51:27 am

Hy,

You can try :

{def $ListeUser=fetch('content','tree' ,hash('parent_node_id',5) }

where 5 is the node_id of the users section.
$ListeUser contains users group and users.

Hope it will help.

Patrice

GDA AS

Monday 06 March 2006 1:11:10 am

I tried this:

fetch(content, tree,
			hash( parent_node_id, 5,
		        class_filter_type, include,
			class_filter_array, array( 'user' ),
			attribute_filter,
			array( array( 'contentobject_id', '=', $survey.user_identifier ) ) ) )}

Where $survey.user_identifier is from a collected_info_collection. It does not work. It fetches users if I remove the attribute filter so there must be something wrong with the filter.

What I want to accomplish is to display the users name (firstname, lastname) of the user who submitted a collected_info_collection.

GDA AS

Monday 06 March 2006 2:39:06 am

The user_identifier attribute of an ezinformationcollection object return something like '12905d5437cf0f07165ede3c8d893fea'.

How do I use this to fetch the coresponding user object? I can't find any attributes in the user object that contain a value similar to that of ezinformationcollection.user_identifier.

Tom Couwberghs

Wednesday 08 March 2006 2:11:36 pm

The syntax of your attribute filter is wrong. It should be:

array( 'and', array('<class_identifier>/<class_attribute_identifier>', '<operator>', '<value>'))

But in your case, this won't do. The problem is that the remote_id of the user isn't a content class attribute in the user class, but a database field in the ezcontentobject table.

To filter on remote id you will need to write an extended attribute filter which filters on this field. The following link explains what it is and how it works.

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/modules/content/fetch_functions/list

GDA AS

Wednesday 08 March 2006 11:07:33 pm

I found out that the user_identifier attribute of an ezinformationcollection is actually a md5-sum of the string "user-" and the user_id of the user who submitted the information. So my filter would not have worked anyway.

eZ systems have made an extension that will translate this to user_id's. This will make it possible to filter ezinformationcollections based on the user_identifier attribute. It will appear under contributions very soon.

Kristian Hole

Thursday 09 March 2006 1:52:20 am

The contribution is now available here:
http://ez.no/community/contribs/hacks/informationcollection_fetch_functions

Enjoy! :-)

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

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 18 2025 20:54:39
Script start
Timing: Jan 18 2025 20:54:39
Module start 'layout'
Timing: Jan 18 2025 20:54:39
Module start 'content'
Timing: Jan 18 2025 20:54:40
Module end 'content'
Timing: Jan 18 2025 20:54:40
Script end

Main resources:

Total runtime1.0408 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0121 587.7891152.6094
Module start 'layout' 0.01210.0032 740.398439.4297
Module start 'content' 0.01531.0239 779.8281656.6563
Module end 'content' 1.03920.0015 1,436.484416.1875
Script end 1.0408  1,452.6719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.3659160.0002
Check MTime0.00140.1355160.0001
Mysql Total
Database connection0.00500.485210.0050
Mysqli_queries0.962592.4792730.0132
Looping result0.00090.0832710.0000
Template Total0.998896.020.4994
Template load0.00240.229920.0012
Template processing0.996495.738120.4982
Template load and register function0.00030.025810.0003
states
state_id_array0.00120.119910.0012
state_identifier_array0.00090.086520.0005
Override
Cache load0.00200.1953470.0000
Sytem overhead
Fetch class attribute can translate value0.00070.063840.0002
Fetch class attribute name0.00150.146290.0002
XML
Image XML parsing0.00280.266640.0007
class_abstraction
Instantiating content class attribute0.00000.001890.0000
General
dbfile0.00280.2657220.0001
String conversion0.00000.000940.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
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.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/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.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: 27
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs