This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » General » Fetch list of users
expandshrink

Fetch list of users

Fetch list of users

Monday 06 March 2006 9:20:37 am - 6 replies

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.

Monday 06 March 2006 9: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

Monday 06 March 2006 10: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.

Monday 06 March 2006 11: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.

Modified on Monday 06 March 2006 11:42:42 am by GDA AS

Wednesday 08 March 2006 11: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/techn...modules/content/fetch_functions/list

Modified on Wednesday 08 March 2006 11:37:37 pm by Tom Couwberghs

Thursday 09 March 2006 8:07:33 am

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.

Thursday 09 March 2006 10:52:20 am

The contribution is now available here:
http://ez.no/community/contribs/h...nformationcollection_fetch_functions

Enjoy! happy.gif Emoticon

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from