We know it is a duty upon every Muslim to call others away from sinful behavior, and to do so with wisdom, within the limits of our various abilities.
The Prophet (peace be upon him) delineated these levels for us when he said: Whoever sees something wrong should change it with his hands. If he is unable to do so, then he should do so with his tongue. If he is unable to do so, then he should do so in his heart, and that is the weakest of faith." [Sahîh Muslim]
We also know that here are some conditions for forbidding wrongdoing, like to be reasonably sure that forbidding something wrong will not result in a greater wrong.
The truth is that calling people away from wrongdoing is a religious duty in and of itself, and remains a duty upon a Muslim even if he or she falls into sin.
There are some texts from the Qur'an and Sunnah that seem to indicate sinners should not call others to righteousness. We shall look at those now.
First, we have where the Prophet (peace be upon him) said:
A man will be brought forward on the Day of Resurrection and thrown into the Fire. His entrails will come forth from his throat and he will hang from them going around like a donkey goes around a mill.
The inhabitants of the Fire will gather around him and ask: "What is the matter with you? Didn't you used to enjoin what is right and forbid what is wrong?"
He will reply: "Yes, I used to enjoin what is right but not do those things myself, and I used to forbid what is wrong but not refrain from them myself." [Sahîh Muslim (2989)]
Some people might get the idea that this man was punished because he enjoined what is right and forbade what is wrong while he was had many shortcomings in his own deeds. This is a big mistake, because the task of enjoining what is right and forbidding what is wrong is inherently worthy of reward as long as the person engaged in it is sincere and has the right intention. This man was being punished because he did the very evil deeds he forbade others from doing and he abandoned the very duties he called others towards. He was merely beautifying his outward conduct while his inner being remained corrupt. His punishment was for his sins, not because he enjoined what is right and forbade what is wrong.
Then there is the verse of the Qur'an which reads: "Do you enjoin right conduct on others and forget to practice it yourselves and yet you recite the Scripture? Do you not have any sense?" [Sûrah al-Baqarah: 44]
In this verse, Allah rebukes these people and punishes them because they turn away from the truth though they know it full well. This makes them different from those who are ignorant of the truth, who if the come to know it would most likely follow it. They are not being punished because they called others to right conduct while being sinful. The point this verse is making is that they know full well what is right – the proof for that being their calling others to what is right – but did what is wrong in spite of their knowledge. This is why the verse concluded with the rebuke "Do you not have any sense?"
Therefore, we should know that enjoining what is right is something we owe to the people, even if we fail to do what is right ourselves. The same goes for forbidding what is wrong.
A poet once said:
If no sinful soul exhorts others to righteousness,
Then who, after Muhammad, will exhort all the sinners?
No one after Allah’s Messenger (peace be upon him) is divinely protected from committing sins. It is, however, the duty upon every person to do the following four things:
1. Do what is right.
2. Enjoin others to what is right.
3. Abstain from what is wrong.
4. Forbid what is wrong.
Failure to perform one of these four duties does give us the right to neglect any of the others. Therefore, someone who commits a sin still has the duty to call others to avoid it.
And Allah knows best.