add_actions called from functions.php not returning good values

Your add_action should be:

add_action( "parse_query", "checkaccess" );