Reputation: 151
I am using groups plugin to hide/show content to specific groups of users. But in order for a page to be shown only to a group of user, that page must be private. But if I make that page private is not showing under its parent page tabs. Even for the assigned group of users. So how can I make a child private page to be shown under the tabs of its parent page for specific group of users?
Upvotes: 0
Views: 47
Reputation: 566
Try this in the *.php page:
$user_id = get_current_user_id();
$group_1 = Groups_Group::read_by_name( 'group1' );
$group_2 = Groups_Group::read_by_name( 'group2' );
if ( Groups_User_Group::read( $user_id, $group_1->group_id ) || Groups_User_Group::read( $user_id, $group_2->group_id ) ) {
$args = ['numberposts' => -1, 'post_parent' => $ID,'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'order' => 'asc', 'orderby' => 'menu_order'];
}
Upvotes: 1