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="[email protected]" />
  </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