In the present work, the role of temperature in the occurrence of optical phases in a system of a large number of atoms interacting with photons is reported. To this end, it is assumed that the cavity inside which the constituents interact is in equilibrium with a heat reservoir, held at a frxed temperature. To achieve this goal, we start with the conventional density operator to calculate the mean values of electromagnetic quadratures. To make the realization of three distinct optical phases, trivial, electric, and magnetic superradiance, possible, the medium inside the cavity is assumed to be a second-order nonlinear one. The nonlinearity of the medium is further assumed to be activated by an externally applied classical pump field. As a consequence, now there are two external controlling agents, the temperature and nonlinearity strength. We then proceed to calculate the quadrature mean values in the thermodynamical limit and for a large number of atoms as a function of temperature. An analysis of the calculated mean values, along with relevant figures, reveals temperature-dependent conditions for realizing trivial, electric, and magnetic optical phases. Moreover, we shall demonstrate that the atom-field coupling strength gives rise to two distinct regimes where the optical phases behave quite differently. In one of the two regimes it is possible for the phases to coexist, while in the other it is not. As a profound result, it is demonstrated that for such a system there can exist a unique temperature (triple point) at which the three optical phases coexist.