[Joseph F. Smith]
... President John Taylor felt called upon to deal with this evil in a drastic way, by imposing upon the bishops the duty of requiring all Church members guilty of sexual sin to make public confession, and ask public forgiveness, and this without taking into account the gravity of the sin committed, or the extent to which it was known. ... The intent of the modification is simply this, that transgression committed in secret should not necessarily be made public; or, to use the language of the revelation [D&C 42], if any offend openly, he or she should be rebuked openly; but if any offend in secret, they should not be rebuked openly. The point therefore we wish to emphasize is that unnecessary punishment should not now be inflicted on wrongdoers by spreading the knowledge of their wrongdoing as to do so is neither good policy, nor is it in the interest of good morals.
[Source: Joseph F. Smith, Letter to W. C. Parkinson, as quoted in Minutes of the Apostles of The Church of Jesus Christ of Latter-day Saints, 1835-1951, Electronic Edition, 2015]