Sorry for my late response. The method name is corrected now. But the problem is still present.
The Post hast the restriction REQ_A.
In the user_can_read_post() method the variable $read_caps has the value:
[0] => "REQ_A"
Everything is fine so far.
In the foreach each required post cap is checked against the users capabilities. The return value is always false.
I was able to fix the problem with this patch: (the injectRegistered part)
$user_capability_table = _groups_get_tablename( "user_capability" );
$limit = $wpdb->get_var( "SELECT COUNT(*) FROM $group_table" );
if ( $limit === null ) {
$limit = 1;
}
// note that limits by blog_id for multisite are
// enforced when a user is added to a blog
$user_groups = $wpdb->get_results( $wpdb->prepare(
"SELECT group_id FROM $user_group_table WHERE user_id = %d",
Groups_Utility::id( $this->user->ID )
) );
if($this->user->ID != 0) {
// the previous statement only covers user<->group dependencies created by the groups plugin but not the 'registered' dependency because it is not stored in the database.
$injectRegistered = new stdClass(); //use same return type as db layer
$injectRegistered->group_id = 1; //group_id for 'registered' is always 1
$user_groups[] = $injectRegistered;
}
// get all capabilities directly assigned (those granted through
// groups are added below
$user_capabilities = $wpdb->get_results( $wpdb->prepare(
"SELECT c.capability_id, c.capability FROM $user_capability_table uc LEFT JOIN $capability_table c ON c.capability_id = uc.capability_id WHERE user_id = %d",
Groups_Utility::id( $this->user->ID )
) );
My plugin version is 1.3.11. Afaik there where no changes in this file in the new version. I can’t update to the newest version because I have to fill in the post restrictions by JS. I was not able to do this in the newest version because of the usage of selectize js lib.