Sayyiduna Sahl bin Sa'd (may Allah be pleased with him) narrates this saying of the Prophet (peace and blessings be upon him): "Whoever enters this mosque of mine in order to learn something good or to teach it is in the rank of one who strives (mujahid) in the path of Allah. And whoever enters it for any other purpose, that is, comes to talk with people, is in the rank of a person who sees something and likes it, but that thing belongs to someone else."
Tabarani recorded it in al-Mu'jam al-Kabir; its chain contains a narrator, Ya'qub bin Humayd bin Kasib, whom Imam Bukhari (may Allah have mercy on him) and Ibn Hibban declared thiqah (trustworthy), while Imam Nasa'i (may Allah have mercy on him) and others called him da'if (weak). They based his weakness only on the fact that a prescribed punishment (hadd) had been carried out on him; his hearing (sama') is sound.
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب العلم / 500
Hadith Gradingمحدثین:إسنادہ حسن۔
Hadith Takhrij«أخرجه المعجم الكبير للطبراني برقم: 5911»