Sunan Ibn Majah, Book 37, Hadith 108 (Ibn Majah 4211)

It was narrated from Jundab that the Messenger of Allah (ﷺ) said:

“Whoever wants to be heard of, Allah will make him heard of, and whoever wants to be seen, Allah will show him (i.e., expose his real motives).”