Hadith 7.3
Prayer
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 <i>mujahid</i> 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 <i>Shu'ab al-iman</i>, transmitted it.
عَنْ أَبِي هُرَيْرَةَ قَالَ: سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ: «مَنْ جَاءَ مَسْجِدي هَذَا لم يَأْته إِلَّا لِخَيْرٍ يَتَعَلَّمُهُ أَوْ يُعَلِّمُهُ فَهُوَ بِمَنْزِلَةِ الْمُجَاهِدِ فِي سَبِيلِ اللَّهِ وَمَنْ جَاءَ لِغَيْرِ ذَلِكَ فَهُوَ بِمَنْزِلَةِ الرَّجُلِ يَنْظُرُ إِلَى مَتَاعِ غَيْرِهِ» . رَوَاهُ ابْنُ مَاجَهْ وَالْبَيْهَقِيُّ فِي شُعَبِ الْإِيمَانِ
Hadith gradings, numbering and translations can differ between editions. For legal rulings or detailed interpretation, consult qualified scholarship and the referenced edition.