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

eZ debug

Timing: Jan 18 2025 18:33:01
Script start
Timing: Jan 18 2025 18:33:01
Module start 'content'
Timing: Jan 18 2025 18:33:02
Module end 'content'
Timing: Jan 18 2025 18:33:02
Script end

Main resources:

Total runtime1.2868 sec
Peak memory usage4,096.0000 KB
Database Queries210

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 589.0313180.8516
Module start 'content' 0.00641.0702 769.8828661.7188
Module end 'content' 1.07660.2101 1,431.6016341.0781
Script end 1.2867  1,772.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.3343210.0002
Check MTime0.00160.1253210.0001
Mysql Total
Database connection0.00060.046710.0006
Mysqli_queries1.200893.31382100.0057
Looping result0.00300.23572080.0000
Template Total1.254097.420.6270
Template load0.00210.163820.0011
Template processing1.251897.282920.6259
Template load and register function0.00010.011710.0001
states
state_id_array0.00100.078710.0010
state_identifier_array0.00140.109420.0007
Override
Cache load0.00200.1547470.0000
Sytem overhead
Fetch class attribute can translate value0.00120.090450.0002
Fetch class attribute name0.00180.137190.0002
XML
Image XML parsing0.00150.113350.0003
class_abstraction
Instantiating content class attribute0.00000.002490.0000
General
dbfile0.00380.2927330.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs