Creating and detecting ferro- and antiferromagnetic order in 2D materials by proximity effects