Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Plugin filtering for admin list pages
etc wrote:
I would not like my
whereclause be concatenated with something I even do not see (debugging nightmare). Of course, I can issue something likeAND 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. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
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?
Offline
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_*_likelevel
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. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
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)
Offline