Abu Huraira said that he heard God’s Messenger say, “If anyone comes to this mosque of mine, coming only for some good which he will learn or teach, he ranks a mujahid in God’s path; but if anyone comes for some other purpose, he ranks as a man who looks [enviously] at another’s property.” Ibn Majah and Baihaqi, in Shu'ab al-iman, transmitted it.
Hadith Referenceمشكوة المصابيح / كتاب الصلاة / 742
Hadith Gradingالألبانی:صَحِيح | زبیر علی زئی:إسناده حسن
Hadith Takhrij´تحقيق و تخريج: محدث العصر حافظ زبير على زئي رحمه الله` «إسناده حسن، رواه ابن ماجه (227) والبيهقي في شعب الإيمان (1698) [و صححه ابن حبان (الموارد: 81) والحاکم (91/1) ووافقه الذهبي .]»