function private_groups_can_user_view_post_id($forum_id)
{
    //get user ID
    $user_id = wp_get_current_user()->ID;
    //then check if they can view the forum the post belongs to
    return private_groups_can_user_view_post($user_id, $forum_id);
}
function pg_get_author_link()
{
    $user_id2 = wp_get_current_user()->ID;
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('post_id' => $post_id, 'link_title' => '', 'type' => 'both', 'size' => 14), 'pg_get_author_link');
    //confirmed topic
    if (bbp_is_topic($post_id)) {
        $topic = bbp_get_topic_post_type();
        $forum_id_check = private_groups_get_forum_id_from_post_id($post_id, $topic);
        //now we can check if the user can view this
        if (!private_groups_can_user_view_post($user_id2, $forum_id_check)) {
            return;
        }
        return bbp_get_topic_author_link($r);
        // Confirmed reply
    } elseif (bbp_is_reply($post_id)) {
        $reply = bbp_get_reply_post_type();
        $forum_id_check = private_groups_get_forum_id_from_post_id($post_id, $reply);
        //now we can check if the user can view this
        if (!private_groups_can_user_view_post($user_id2, $forum_id_check)) {
            return;
        }
        return bbp_get_reply_author_link($r);
    }
    // Neither a reply nor a topic, so could be a revision
    //if it isn't a topic or reply, not sure so better to just not display the author in this case
    //could be revised to look up the post_parent of this post and then churn that round the code above if required return ;
    return;
}
function private_groups_get_dropdown_forums($forum_list)
{
    $filtered_forums = array();
    //Get Current User ID
    $user_id = wp_get_current_user()->ID;
    foreach ($forum_list as $forum) {
        //check if user can view this forum (and hence posts in this forum)
        if (private_groups_can_user_view_post($user_id, $forum)) {
            array_push($filtered_forums, $forum);
        }
    }
    return (array) $filtered_forums;
}