Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › restricting results › Reply To: restricting results
Hi,
I understand that, but each plugin works differently. I am not the developer of S2Members plugin, I don’t know how it hooks into different functions of the WordPress core.
It is impossible for us to test our plugins against all of the major plugins out there, but of course everyone tries to make everything work together and making compatible.
To make it work the first step is to get to the S2Members api to find an internal S2Member plugin function – and I am sure there is one – which we can substitute into the code you mentioned above. Then simply change that one line where the role check is executed:
!current_user_can(‘read_post’, $r->id)
I am more than happy to help with the integration for a 3rd party plugin, even though it is not part of our support duties. If you know of any developer documentation, API or knowledge base links for that plugin, please feel free to share with us.
The closest I could find is this one. However I don’t know if that works in the ajax context, but worth a try:
add_filter( 'asp_results', 'asp_filter_posts_by_capability', 10, 1 );
function asp_filter_posts_by_capability( $results ) {
foreach ($results as $k => &$r ) {
if ( !is_permitted_by_s2member($r->id) )
unset($results[$k]);
}
return $results;
}