Chiral perturbation theory in a magnetic background — finite-temperature effects