A woman with istihaadah (irregular bleeding) who had a regular cycle should stop praying at the time when she used to get her menses, whether at the beginning of the month, in the middle or at the end

Question My period has been irregular for more than two years. I get it for seven days three months in a row. I am not married. Seven months ago, my period started to come once every two months. I used a folk remedy three months ago, and my period started to last for ten or fifteen days, so I started to regard the first seven days as hayd (menses) and the rest as istihaadah (irregular bleeding). My period came on 16 Sha‘baan as usual, and as usual I regarded the first seven days as menses and the rest as istihaadah. On 27 Sha‘baan, I took pills to stop the period, and the bleeding stopped for four days. I did ‘umrah in Makkah on 2 Ramadan, and because of the physical exertion and walking, my period started again, even though I did not stop taking the pills. Even though I saw the blood, I carried on fasting and praying in the Haram in Makkah until 14 Ramadan, when the bleeding stopped. Are my prayers and fasting valid? Answer Praise be to Allah. Firstly: The basic principl...