Forums / General / Fetch list of users

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