Empty “Topics started” and “Replies created”: hides private forums’ data
-
Hello,
I’ve got a Participant roled user who can current_user_can( ‘read_private_forums’ ) but cannot current_user_can( ‘read_hidden_forums’ ).
I’ve got three forums: two private and one hidden, so I expect to see the topics and replies he’s done in the two private forums, but I see the messages “You have not created any topics.” and “You have not replied to any topics.”While debugging, I’ve seen that the “_bbp_private_forums” option contains the two private forum IDs but the “_bbp_hidden_forums” option contains all the three forum IDs.
I’ve executed the function bbp_repair_forum_visibility() to ensure my data is well retrieved from the database.
While debugging the restore of these options, I can see that the “_bbp_hidden_forums” is built by the result of:
$hidden_forums = new WP_Query( array(
‘suppress_filters’ => true,
‘nopaging’ => true,
‘post_type’ => bbp_get_forum_post_type(),
‘post_status’ => bbp_get_hidden_status_id(),
‘fields’ => ‘ids’
) );
This call triggers the filter “pre_get_posts”, calling the function bbp_pre_get_posts_normalize_forum_visibility( $posts_query = null )If I’m not wrong, this function builds an array whith the different post_status values to filter the query executed and stored in $hidden_forums IDs (and posts) values (or so)
The problem is that in the $private_forums iteration it returns an array with only the “private” value, but in the $hidden_forums iteration it returns an array with two values: “hidden” and “private”The $private_forums iteration is used when a user cannot read private forums, but my user can.
The $hidden_forums iteration is used when a user cannot read hidden forums, it’s my case, but I can read private forums and they are also filtered.I’m with WP 4.2.2, BP 2.2.1 and bbP 2.5.7
Any idea? I’m very lost at this point…
Thanks
- You must be logged in to reply to this topic.