Switch an entire nav menu if user is logged in

There are a couple of issues with the original code. In the if statement, $args['menu'] is being set to Non-Members Area (which will then evaluate to true). It looks like you actually want to be doing an equality check there. A good way to avoid this is to use Yoda conditions.

Also, the $args array should always be returned, so it should be moved out of the conditional statement. Here’s an updated version of the original code:

add_filter( 'wp_nav_menu_args', 'foobar' );
function foobar( $args ) {

    if ( is_user_logged_in() && 'Non-Members Area' === $args['menu'] ) {
        $args['menu'] = 'Members Area';
    }

    return $args;
}