If you sincerely repent of a stupid stupid thing you did (adultery) are you forgiven? Can you still marry in the temple? Can you still gain a higher glory?
I am humbled to be able to answer this delicate question and as such, I will be both, tactful, yet, forward in my response in the hopes to be clear as to where the Lord stands with serious sin. Albeit, I am not perfect and I do not claim to be freed from sin. I am not from a place of judgement but of Love.
And that’s where I would like to begin: LOVE!
Our Father in Heaven has an immense love for all of His children that the human mind cannot comprehend. In John 3:16 we read
“For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.”
Isn’t it wonderful to think that God, the Father of all Living is so involved in our eternal well-being that He gave his only Begotten in the flesh to save us from eternal misery? Can you imagine how great that is? Not only that, but, can you imagine that Our Lord and savior, even JESUS CHRIST loves us so much that he volunteered to be a sacrificial lamb so that you and I could have a choice and not be bound to obedience and be forced to follow someone’s version of eternity?
According to scripture, we shouted for joy (Job 38:7) when we heard this plan and when we understood the great love our heavenly parents have for us.
We know by modern revelation that there is nothing we do here on earth that can prevent us from attaining our eternal reward, except, denying the HOLY GHOST and the shedding of innocent blood.
So, having said that, LDS.ORG clearly states what the Law of Chastity is:
“Physical intimacy between husband and wife is a beautiful and sacred part of God’s plan for His children. It is an expression of love within marriage and allows husband and wife to participate in the creation of life. God has commanded that this sacred power be expressed only between a man and a woman who are legally married. The law of chastity applies to both men and women. It includes strict abstinence from sexual relations before marriage and complete fidelity and loyalty to one’s spouse after marriage.
In addition to reserving sexual intimacy for marriage, we obey the law of chastity by controlling our thoughts, words, and actions. Jesus Christ taught,“Ye have heard that it was said by them of old time, Thou shalt not commit adultery: but I say unto you, That whosoever looketh on a woman to lust after her hath committed adultery with her already in his heart” (Matthew 5:27–28).”
So, it is clear that this law is very significant and that it must be obeyed in order to obtain the Celestial Kingdom, and thus, this brings me to your question:
In short, yes, we can obtain the celestial kingdom so long as we dutifully and remorsefully repent and make the necessary changes to never do it again. Ezra Taft Benson called this “a reformation of life”
“I would not have anyone believe that there is no hope if there are some who have made such a grievous mistake, because repentance and forgiveness are also a part of the gospel. Thank God for that! But it must be real repentance. Such repentance is a deep, heartfelt sorrow for sin that produces a reformation of life. It is not just a confession of guilt.”
Some times we regard the all too lightly the principle of repentance, thinking that it only means confession, that it only means feeling sorry for ourselves. But it is more than that. It is a deep, burning, and heartfelt sorrow for sin that will drive us to our knees in humility and tears— a deep heartfelt sorrow for sin that produces a reformation of life. That is the right test: a reformation of life. Only then may the God of Heaven in his mercy and his goodness see fit to forgive us. HE—not the priesthood on earth—is the judge. Priesthood holders can only carryout certain requirements. They can require certain things set forth in the revelations, but true forgiveness comes from above.”
-President Ezra Taft Benson (God, Family, Country: Our Three Great Loyalties, Salt Lake City: Deseret Book Co., 1988, p. 196.) (emphasis added)
Isn’t it wonderful that all we need to do is recognize that we ought to change and accept the atonement of the Savior and change, reform our behavior and line it up to that of the Gospel of Jesus Christ. Of course, I do not mean to imply that it is easy, which I know it’s far from it. But the effort and struggle is worth it.
Do not give up! Do not allow the adversary convince you that there is no hope, because there is. His Name is Jehovah, The Prince of Peace. The King of Kings, The mighty One. Even JESUS CHRIST!
Once you have disclosed your sins to the appropriate priesthood holder (i.e. your bishop), and once you have gone through the deep heartfelt sorrow president Benson spoke of in my last quote, then and only then will you know the peace and assurance that in the House of the Lord, you will be able to feel of his forgiveness and know you’ll be welcomed there with open arms, just like when the father received his son the prodigal one (Luke 15:11-32).
May God bless you and your efforts in achieving your eternal potential.