Hadrat Abu Zarr Gaffari (Radi Allaahu Ta’ala Anhu) narrated: The Messenger of ALLAH (Sallallahu Alaihi Wa Sallam) was asked, “What do you say about a man who does good deeds and is on that account spoken well by the people? (According to another narration the last clause was: is loved by the people?) He replied, This is real good tiding for a true Muslim.” [Sahih Muslim]
Similarly if someone does any good work openly with the intention that others may follow him and learn to do likewise, then it will not be taken as dissimulation: but in such a situation that servant of ALLAH will get divine reward for teaching and preaching (religion). From numerous traditions it appears that this was the intention behind many actions of the Prophet (Sallallahu Alaihi Wa Sallam).
May ALLAH bless us with selflessness and sincerity of purpose, make us His true servants and protect our hearts from ruinous attacks of dissimulation and running after fame. [Ma’arif-ul-Hadis]