Sefer Chofetz Chaim chapter 4, halacha 7, footnotes 31 & 32

Footnote 31: When the Chofetz Chaim says you are allowed to speaking badly about someone who is purposely sinning and refuses to listen to rebuke that is only if someone influential who is worth listening to and can be trusted rebuked him or if you showed him in an authoritative halachic Sefer that what he is doing is wrong. But if you aren’t influential enough, even if your rebuke is true that doesn’t give you license to speak lashon hara because maybe he just didn’t believe you and thought you were wrong. Rather you should just tell a figure of authority let him deal with it and if the sinner still doesn’t listen then you can spread the word about how terrible this person.

Footnote 32: However there is five condition that must be met before talking slanderously about a person who you know always purposely does a sin which people know is wrong, however if this person is one who threw off the yoke of Heaven and just doesn’t care then you don’t have to meet these five conditions:

               1.            You have to have seen the sin your self or everyone in town knows about this guy’s bad deeds.

               2.            The sin you saw him do either had  to be black and white wrong or one must thoughrally check into the matter to be sure he did something wrong before spreading slander about him.

               3.            Don’t exaggerate.

               4.            Your intentions should be altruistic for the good of society to keep them away from evil, no ulterior motives like just hating the guy, making yourself famous, rather just spread the word for the sake of truth.

               5.            You can’t slander him behind his back but flatter him to his face unless you are afraid he will hurt you then you can spread the word in private individually as long as your intentions are for the sake of Heaven, sanctifying Hashem’s Name.