Symmetries in magnetic phase transitions: I. The Landau-Ginzburg-Wilson Hamiltonian