Can ghusl from janaabah also count as ghusl following menses and vice versa?
Question

If I believed that the yellowish discharge was istihaadah [non-menstrual discharge] and I prayed and did not repeat my ghusl, then after that I found out that the yellowish discharge is part of the menses if it follows on directly from it, and I had done ghusl after that from janaabah [impurity following intercourse], does the ghusl from janaabah also count [as ghusl following menses]?
Praise be to Allah.Firstly:
If the yellowish or brownish discharge comes at the usual time of menses or follow on directly from the bleeding, then it is part of menses.
If it occurs after the menses has ended, then it does not matter, because of the report narrated by Maalik in al-Muwatta’ (130) from Umm ‘Alqamah, who said: Women used to send to ‘Aa’ishah, the Mother of the Believers, small vessels in which were pieces of cotton, on which were yellowish traces from menstrual bleeding, asking her about praying.
She would say to them: Do not be hasty, until you see the white discharge. What she meant by that was purity from menses (the end of the menses).
This was also narrated by al-Bukhaari in a mu‘allaq report (Kitaab al-Hayd, Baab Iqbaal al-Maheed wa Idbaaruhu).
And Umm ‘Atiyyah (may Allah be pleased with her) said: We used not to regard the yellowish or brownish discharge after becoming pure from menses as being of any significance. Narrated by Abu Daawood (307); classed as saheeh by al-Albaani in Irwaa’ al-Ghaleel (199).
Secondly:
If a woman is in a state of janaabah and her menses has also ended, and she does one ghusl with the intention of purifying herself from both, that is acceptable according to the majority of scholars.
Similarly, if she intends one of them and does not intend the other, it is still acceptable according to the majority of Maalikis, Shaafa‘is and Hanbalis.
It says in al-Mughni (1/253):
If two things occur that both require ghusl, such as the end of menses and janaabah, or the “meeting of the two circumcised parts” and ejaculation, and the individual intends purification from both when doing ghusl, it is acceptable for both. This was stated by most of the scholars, including ‘Ataa’, Abu’z-Zinnaad, Rabee‘ah, Maalik, ash-Shaafa‘i, Ishaaq and as-haab ar-ra’y.
However, it was narrated from al-Hasan and an-Nakha‘i that in the case of a woman whose period has ended and she is in a state of jaanabah, that she must do ghusl twice.
But we think that the Prophet (blessings and peace of Allah be upon him) only did one ghusl in the case of intercourse, which involves two things, because it implies ejaculation in most cases, and because they are two reasons that make ghusl obligatory, so one ghusl is acceptable for both, just as when one does wudoo’ to remove both intangible and tangible impurity at the same time.
The same ruling applies if there are a number of reasons that make minor purification (i.e., wudoo’) obligatory, such as sleep, the emission of impurity, or touching. If the person intends when purifying himself to remove impurity or make it permissible for him to pray, then it is acceptable for all of them.
If he intends only one of them, or if a woman intends to purify herself following menses but not from janaabah, is it acceptable for the other?
There are two views, one of which is that it is acceptable for the other, because it is a valid ghusl in which he intended to do that which was obligatory, so it is acceptable, such as if he intended to make it permissible for him to pray.
The second view is that it is acceptable for that for which he formed the intention, but not for that which he did not intend, because the Prophet (blessings and peace of Allah be upon him) said: “Every person will have but that which he intended.” Similarly, if he does ghusl for Jumu‘ah, is it acceptable as purification from janaabah? There are two views. End quote.
Ad-Dardeer said in ash-Sharh al-Kabeer (1/133): If a woman in a state of janaabah whose menses or nifaas (postpartum bleeding) has ended intends when doing ghusl to [purify herself] from both menses or nifaas and janaabah at the same time, or if she intends one of them, whether forgetting about the other or remembering it but not excluding it [from her intention], then it counts for both. End quote.
What is meant by “but not excluding it” is she did not intend to remove any other type of impurity, as we shall see below.
An-Nawawi said in al-Majmoo‘ (1/327): If a woman has to do ghusl for janaabah and menses, and forms the intention for one of them, her ghusl is valid and counts for both. There is no difference of scholarly opinion on this matter. End quote.
See also Mughni al-Muhtaaj (1/72).
It says in Kashshaaf al-Qinaa‘ (1/90): If there are several types of impurity, even if they occurred at different times and require wudoo’, such as urinating, defecating, breaking wind and sleeping, or they require ghusl, such as intercourse, the emission of maniy and menses, and the individual intends one of them when purifying himself, it is removed – that is, the impurity that he intended is removed, and so are the others. That is because types of impurity are interconnected, so if he intends one of them without qualification, all of them are removed, such as if he intends to remove impurity in general terms.  But if he intends to remove one of the kinds of impurity, and intends not to remove any other, then the other is not removed, because he purified himself with the intention of leaving other types of impurity, so nothing is removed except what he intended, otherwise that would imply something that what he intended not to remove was removed too. End quote.
It says in ash-Sharh al-Mumti‘ by Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him), (1/202): The words “if there are several types of impurity which require wudoo’” mean: If he did several of the things that invalidate wudoo’, such as if he urinated, defecated, slept, and ate camel meat, and intended to purify himself from having urinated, then that would suffice for all of them.
But if he intended to purify himself from having urinated only, and not to remove the other types of impurity, then it would only count as purification from having urinated, because of the general meaning of the words of the Prophet (blessings and peace of Allah be upon him): “Actions are but by intentions, and each person will have but that which he intended.”
And it was said that it will suffice both for that and for other things, because hadath (impurity) is a single description, even though the causes for it are numerous, so it cannot be numerous. Therefore if he intends to remove it, it is removed, even if he only specified one of several reasons.
And it was said that if he specifies the first reason, the rest are removed, and if he specifies the second, none of them are removed, because the second occurred in a state of impurity, not in a state of purity, such as if he urinated first, then he defecated, then did wudoo’ to purify himself from having defecated only. In that case the impurity would not be removed, because the second impurity occurred when he was already in a state of impurity, so it did not affect anything. In that case, if he intended to remove the impurity from the second, it was not removed, because the state of impurity resulted from the first, not the second.
The correct view is that if he intended to remove impurity due to either of them, then it was removed from all of them, even if he intended not to remove anything else, because impurity is a single description, even if the reasons for it are numerous. So if he intended to remove it from having urinated, then it is removed.
This is not contrary to the words of the Prophet (blessings and peace of Allah be upon him), “and each person will have but that which he intended,” even though this person only intended to remove the impurity of having urinated, because impurity is a single thing, so if he intended to remove it then it is removed. It cannot be said that if a person urinates at 1 o’clock, for example, he has one impurity, and if he defecates at 1.30 he has another impurity, and so on; rather it is all one impurity, even though there is more than one reason for it.
Based on that, your having done ghusl from janaabah is acceptable, and it also removes the impurity of menses.
You do not have to do anything with regard to the prayers that you offered during your menses, thinking that it was istihaadah (non-menstrual bleeding).
And Allah knows best.