Please add join, where filter to GetCustomWritePanels() to support category filtering

0 views
Skip to first unread message

agapetry

unread,
Sep 19, 2009, 2:35:19 AM9/19/09
to Flutter Support, m...@jenswedin.com
Congratulations on a powerful plugin!

I'm the author of the <a href="http://wordpress.org/extend/plugins/
role-scoper/">Role Scoper plugin</a>, looking to cooperate with you in
satisfying a mutual user. Role Scoper enables post editing roles to
be restricted or assigned for specific categories. Jens Wedin has
requested that access to Custom Write Post Panels be synchronized with
these category-specific roles. The goal is to hide and block access
to a Panel if the logged user cannot post in any of that panel's
categories.

I have written some code which accomplishes this goal, but for a clean
implementation it requires the following change (or something like it)
in your RCCWP_CustomWritePanel::GetCustomWritePanels() function. The
idea is to add join and where filters, as in the WP posts query:

<pre>
function GetCustomWritePanels()
{
global $wpdb;

$sql = "SELECT id, name, description, display_order, capability_name,
type, single FROM " . RC_CWP_TABLE_PANELS;

$join = apply_filters( 'panels_join_fp', '' );
$where = apply_filters( 'panels_where_fp', '' );

$sql .= " $join WHERE 1=1 $where ORDER BY display_order ASC";
$results = $wpdb->get_results($sql);
if (!isset($results))
$results = array();

return $results;
}
</pre>

I will include this Flutter support in my next release if you can
support it on your end.

Let me know if you'd like any more feedback from me.

math...@googlemail.com

unread,
Oct 9, 2009, 5:33:15 PM10/9/09
to Flutter Support
this would be so great! :)
Reply all
Reply to author
Forward
0 new messages