Viewing 1 replies (of 1 total)
  • Plugin Author Kento

    (@proaktion)

    Hi,

    I’m not exactly sure that this is what you want, but based on https://www.itthinx.com/2013/02/12/how-to-hide-the-woocommerce-shop-page/ which explains how you can hide the shop pages and taking into account the newer model based on groups directly (instead of using capabilities), the updated code snippet would be:

    if ( class_exists( 'Groups_Group' ) && class_exists( 'Groups_User' ) ) {
    	$redirect = true;
    	if ( $user_id = get_current_user_id() ) {
    		$user = new Groups_User( $user_id );
    		if ( $group = Groups_Group::read_by_name( 'Members' ) ) {
    			if ( $user->is_member( $group->group_id ) ) {
    				$redirect = false;
    			}
    		}
    	}
    	if ( $redirect ) {
    		wp_redirect( get_bloginfo( 'home' ) );
    		exit;
    	}
    }

    This assumes that those who should be able to see your products belong to a group named “Members”.

    I hope that helps, but please let me know if you need further help.

    Cheers

    • This reply was modified 7 years, 8 months ago by Kento. Reason: wording
Viewing 1 replies (of 1 total)
  • The topic ‘Group can only VIEW a page’ is closed to new replies.