Textpattern Forum

You are not logged in. Register | Login | Help

#31 2012-07-27 12:29:48

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,916
Website

Re: Plugin filtering for admin list pages

etc wrote:

I would not like my where clause be concatenated with something I even do not see (debugging nightmare). Of course, I can issue something like AND 0 OR ..., but prefer avoid hacking.

This crossed my mind as I was writing it last night. For that reason I’d started out passing $criteria as the 3rd param, then removed it after the most recent exchange above.

For searches, as you say, the criteria will be something other than ‘1’ so under these circumstances, yeah, perhaps it’d be nice to know if a search has been performed so you can either append to what is already present, or just ignore search criteria (at your users’ peril!). It can’t hurt to include it so plugin authors can stay informed. Leave it with me.

Last edited by Bloke (2012-07-27 13:05:37)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#32 2012-07-27 12:48:15

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,232
Website

Re: Plugin filtering for admin list pages

Many thanks! and I can’t stop thinking that you’d have less modifications to do if it were implemented at some safe_*_like level, maybe in some future version?


etc_[ query | search | pagination | date | tree | url ]

Offline

#33 2012-07-27 13:03:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,916
Website

Re: Plugin filtering for admin list pages

There you go. I’ll update the code above to cater for the new function signature.

etc wrote:

I can’t stop thinking that you’d have less modifications to do if it were implemented at some safe_*_like level

Not exactly much work, and I’m with Jukka on this at the moment.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#34 2012-07-27 13:20:26

etc
Plugin Author
Registered: 2010-11-11
Posts: 1,232
Website

Re: Plugin filtering for admin list pages

Bloke wrote:

Not exactly much work, and I’m with Jukka on this at the moment.

Fine, me too, it could rather be something like $criteria = get_user_criteria($criteria, ‘admin_criteria’, ‘image_list’, ... ); function, which only does

$out = callback_event('admin_criteria', 'section_list', 0, $criteria);
return( $out === '' ? $criteria : $out );

but let us forget it. Nevertheless (hiding myself under the table), my suggestion was to replace $criteria .= callback_event(...) by $out = callback_event(...); if($out !== '') $criteria = $out; like for other callbacks. “$criteria AND …” is more natural for me (plugin author) than “ AND …” as where clause.

Last edited by etc (2012-07-27 13:40:06)


etc_[ query | search | pagination | date | tree | url ]

Offline

Board footer

Powered by FluxBB