The Messenger of Allah ﷺ said the same as the hadith of Ubaydullah, and he said, "And a man whose heart is attached to the mosque from the time he leaves it until he returns to it."
و حدثنا يحيى بن يحيى قال قرأت على مالك عن خبيب بن عبد الرحمن عن حفص بن عاصم عن أبي سعيد الخدري أو
قال رسول الله ﷺ بمثل حديث عبيد الله وقال ورجل معلق بالمسجد إذا خرج منه حتى يعود إليه