There are two principal requirements for any act to be accepted: first, dedicating this act to Allah, and secondly, following in the footsteps of the Prophet (peace and blessings be upon him). Here, Satan devises a vicious trick to divert people from persisting in their acts of worship. Satan whispers to the devoted worshippers making them believe that the good deeds they offer are meant for showing off (riya’) and as such, will not be accepted. Unfortunately, some people may be fooled by this trick and start neglecting their acts of worship. They tend to come late to the mosque, abstain from supplicating Allah, and cease to participate in charitable activities out of fear that they may be guilty of riya’. Day after day, they lose their activity and vitality.
Shedding light on this phenomenon, the prominent Saudi scholar, Sheikh Salman ibn Fahd al-`Udah, states: Al-Fudayl ibn `Iyad spoke harsh words to those who abandoned performing good works because of the people. He said, “Abandoning deeds because of the people is showing off. Performing deeds for their sake is polytheism. Sincerity is where Allah protects you from both.”

Some people go to the mosque and when they see people there, they become afraid of showing off. They start to come to the mosque late and might even miss the Prayer altogether at times. This becomes their habit. Coming to the mosque early becomes one of the most difficult things for them to do.
Likewise, some people who read or memorize the Qur’an stop reading when they see that others are listening to them, because they are afraid of showing off. This is tragic, especially when the people who do so are among those who have memorized the Qur’an or who teach it to others.
Abandoning one’s good deeds is a grave error. What the worshipper must do is to cease worrying about people altogether; neither performing anything for their sake nor abstaining from anything for their sake.
One of the reasons for this behavior is that the person who is supposed to perform a given deed has an exaggerated view of his own importance and the importance of what he is about to do. He may have to give the Friday sermon or give a small talk after prayer. He begins to imagine that what he is doing is some great deed and that people will start quoting his words. Maybe he thinks that what he has to say will become the talk of the town. He may become a bit impressed with himself at this point, and here he starts to fear being guilty of showing off. He sees that the only way is to play it safe and not to talk and not to act.
This is one of the devil’s tricks. The only way for a person to remain immune to it is to be accustomed to doing good deeds and to see those deeds as small and insignificant when he does them. At the same time, he must accustom himself to not attaching any importance to what people say. He must be able to recognize his own faults and realize the shortcomings in his efforts. Then, when someone praises him, it will not harm him in any way. Such praise will then be as the Prophet (peace be upon him) described it: (…early glad tidings being presented to the believer.) [Muslim]

Thus, the believer has to dedicate his intention and his work to Allah and pay no heed to what people say. If he sets his mind to do a good deed, he is to go ahead without any hesitation or fear of showing off. In addition, he has to keep asking Allah to purify his intention and render it for His sake.