In The Name of Allaah, The Most Merciful, The Bestower of Mercy.
Imaam Muhammad Bin Saaleh Al-Uthaymeen [rahimahullaah] said:
If all the people were pleased with you and Allaah is not pleased with you, then indeed it will not benefit you except the Pleasure of Allaah [The Mighty and Majestic]; for indeed if Allaah is pleased with you, He will make people become pleased with you and make their hearts incline towards you, as it has been reported in a hadeeth, “Indeed, when Allah loves a servant, He calls Jibreel and says, ‘Verily, I love this person so you should love him’. Then Jibreel loves him and makes an announcement in the heavens, saying, ‘Indeed, Allaah loves this person and you should love him’; so the inhabitants of the heavens love him. Then he is granted the [pleasure and acceptance] of the [people] in the earth”, just as Allaah said:
إِنَّ ٱلَّذِينَ ءَامَنُواْ وَعَمِلُواْ ٱلصَّـٰلِحَـٰتِ سَيَجۡعَلُ لَهُمُ ٱلرَّحۡمَـٰنُ وُدًّ۬ا
Verily, those who believe [in the Oneness of Allah and in His Messenger (Muhammad)] and work deeds of righteousness, the Most Beneficent (Allah) will bestow love for them (in the hearts of the believers). [Surah Maryam. Aayah 96]
However, if a person seeks after the pleasure of the people at the expense of Allaah’s displeasure [or anger], the affair will be the opposite. Allaah will be angry with him and will make the people become angry with him. This is why when Mu’aawiyah [radiyallaahu -anhu] became the Khaleefah, Aa’isha [radiyallaahu anhaa] wrote to him, saying, “I heard the Prophet [sallal laahu alayhi wasallam] say, ‘Whoever seeks the pleasure of Allaah at the expense of the displeasure of the people, Allaah will suffice him against the people. Whoever seeks the pleasure of people at the expense of Allaah’s displeasure, Allaah will leave his affair to the people’”.
An Excerpt from ‘Riyaadh As-Saaliheen 1/163. Slightly paraphrased.