Answered by Shaykh Faraz Rabbani
I was told by someone that if one consumes haraam EVEN UNINTENTIONALLY, your salah is not valid for 40 days. is this true?

Walaikum assalam wa rahmatullah,
This is not true: eating haram intentionally or out of undue laxity may well affect the acceptance of your prayer. However, Allah does not punish us on hidden technicalities: mistakes are forgiven or overlooked.
However, one should be careful regarding what one eats, and if one errs, even by mistake, one should realize one’s shortcomings and seek Allah’s forgiveness.
The Messenger of Allah (Allah bless him and give him peace) is reported to have said, “Allah has overlooked my community’s mistakes, forgetfulness, and that which they were forced into.” [Ibn Maja]
And Allah alone gives success.
Wassalam,
Faraz Rabbani