Wa `alaykum as-salamu wa rahmatullahi wa barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
Responding to your question, Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
A woman who has normal menstrual cycles, and experiences abnormal bleeding in some months, should go for a specialized doctor for medical check-up and counseling. This will help her to know the type of bleeding she experiences in order to act accordingly.
If I can understand your question: prior to your second child was born, you have had a regular pattern of menses; then following the delivery, you started experiencing chronic bleeding– exceeding your pattern of menses.
If this is correct, then you need to consider the pattern you have had prior to this incident as belonging to menses; after which you are to perform ghusl (bathing) and start praying and fasting.
In the case of prayer, however, you need to wash your private parts and make wudu (ablution) for each salah; you also need to fast. If you did leave out prayers or fasts thinking that the chronic bleeding was due to menses, you need to make up for them.
To state differently, if your regular pattern had been 7 days of menses, then you need to consider the same number of days as your days of menses; after which time, you need to perform ghusl and start praying as described above. For the bleeding exceeding your pattern of menses is not considered as due to menses; it is considered as istihadah. The rules of istihadah are not the same as those of menses.
Regarding your second question, you are allowed to visit the mosque while menstruating– as long as you do not defile the mosque, and as long as you do not join the lines of the worshippers. This is the preferred ruling of Imam Ibn Taymiyyah and others. You are allowed to follow this ruling–since you are going there to acquire beneficial knowledge.
Allah Almighty knows best.