Forums / Developer / attribute_filter on ezauthor field

attribute_filter on ezauthor field

Author Message

Håvard Eek

Thursday 29 April 2004 5:16:09 pm

Hi,

I am trying to use the following fetch with a attribute filter on a ezauthor field:

{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
		sort_by, array(array(published,false())),
		attribute_filter , array( array( 166, '=', 'Knut Knutsen')),
		class_filter_type, include,
		class_filter_array, array('arrangement') ) )}

This fetch will return everything and not limit the fetch on 'Knut Knutsen' as I want.
The arrangement class is a custom class that I have made.
Is this possible in ez? And, if so, how would I do this?

Regards,
Håvard Eek

Eirik Alfstad Johansen

Friday 30 April 2004 12:06:03 am

Hi Håvard,

Pleaase try the following code:

{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
		sort_by, array(array(published,false())),
		attribute_filter , array( 'or', array( 166, '=', 'Knut Knutsen')),
		class_filter_type, include,
		class_filter_array, array('arrangement') ) )}

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Eirik Alfstad Johansen

Friday 30 April 2004 12:18:04 am

Hi Håvard,

On second thought, this probably won't work after all. I was thinking there might be a syntax error in your fetch, but that was before I noticed that you were using the ezauthor datatype and not text line. BTW, I took a peek into the db, and here's what the contents of an object attribute built upon the ezauthor datatype looks like:

<?xml version="1.0" encoding="UTF-8"?>
<ezauthor>
  <authors>
    <author id="0"
            name="John Doe"
            email="john@company.com" />
  </authors>
</ezauthor>

I don't have any good ideas as to what value to use when fetching objects of a specific author, though, or if it's even possible.

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Paul Forsyth

Friday 30 April 2004 1:01:28 am

I think the author datatype returns a list of authors, since the datatype is meant to handle multiple authors. If you want to check for authors then you need to explicitly work through the returned array checking its values.

A useful addition to attribute_filter would be to look in arrays too :)

paul

--
http://www.visionwt.com

Håvard Eek

Friday 30 April 2004 1:44:26 am

Thanks for the replies!
What I actually is tying to do here is limit the fetch for the current user.
So that the current user only gets the arrangments that he has created.
If this is not possible (with fetch on ezauthor), I will try a work around.
E.g. create a text field in the arrangement class that will be filled with the username upon creation, and then do a fetch based on this username.

Regards,
Håvard Eek

Nicolas Heiringhoff

Friday 07 May 2004 2:28:32 am

hello Håvard,

we have the same problem over here and do not have a proper solution either.
If you do that workaround that you propose, you have to fill in the field with the username manually each time an author creates an new article. I think this is somehow inconvenient. Is there any possibility to fill in that field with the username automatically?

Greetings,
Nico

http://www.heiringhoff.de

eZ debug

Timing: Jan 19 2025 07:12:03
Script start
Timing: Jan 19 2025 07:12:03
Module start 'content'
Timing: Jan 19 2025 07:12:04
Module end 'content'
Timing: Jan 19 2025 07:12:05
Script end

Main resources:

Total runtime1.8641 sec
Peak memory usage4,096.0000 KB
Database Queries207

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 588.9766180.8281
Module start 'content' 0.00731.6788 769.8047658.1797
Module end 'content' 1.68620.1779 1,427.9844337.0547
Script end 1.8640  1,765.0391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.2276210.0002
Check MTime0.00150.0827210.0001
Mysql Total
Database connection0.00130.069010.0013
Mysqli_queries1.774295.17842070.0086
Looping result0.00220.11972050.0000
Template Total1.829298.120.9146
Template load0.00170.092920.0009
Template processing1.827598.035620.9137
Template load and register function0.00020.012410.0002
states
state_id_array0.00210.113310.0021
state_identifier_array0.00200.109020.0010
Override
Cache load0.00150.0827490.0000
Sytem overhead
Fetch class attribute can translate value0.00160.084250.0003
Fetch class attribute name0.00160.086380.0002
XML
Image XML parsing0.00160.088150.0003
class_abstraction
Instantiating content class attribute0.00000.001290.0000
General
dbfile0.00600.3200330.0002
String conversion0.00000.000230.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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
9content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/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: 39
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs