Shaykh Bakr Abu Zayd رحمه الله said,
"The principle of all principles mentioned in this book, as well as the principle of every required action is in your understanding that knowledge is worship. Some scholars said, 'Knowledge is a secretive prayer and the worship of the heart.' Therefore the condition of worship is:
Firstly: Sincerity of intention for Allaah سبحانه و تعالى, due to His saying:
'And they were commanded not, but that they should worship Allaah, and worship none but Him Alone (abstaining from ascribing partners to Him), and perform As-Salat (Iqamat-as-Salat) and give Zakat: and that is the right religion.' (Sooratul-Bayyinah, 98:5)
Also [we find] in the famous hadeeth, which was narrated through only one chain upon the authority of the Commander of the Believers Umar ibn al-Khattaab رضي الله عنه, that the Prophet صلى الله عليه وسلم said: 'Actions are but by intentions...'
So if knowledge is devoid of sincere intention then it is transformed from being amongst the most noble acts of worship to being one of the lowest forms of violation, and there is nothing that destroys [the blessing of] knowledge as much as riyaa' (showing off), be it riyaa' of shirk or riyaa' of ikhlaas and alsotasmee (showing off with the intent of being heard of); an example of such is the musmi' (the person carrying out this action) saying: 'I know [such and such],' or, 'I have memorized such and such,' etc.
Therefore, adhere to freeing yourself from everything that blemishes your intention of seeking [knowledge] such as love of standing out, and rising above your colleagues and turning them into objects of achieving [hidden] objectives and attaining [worldly] pleasures; such as [seeking] wealth, glory, fame (by way of hearsay), praiseworthiness, or intending to turn peoples faces in your direction; for these, and other similar things that are such that if they blemish ones intention they will corrupt it, and the blessing from knowledge will be lost. For this reason it is incumbent upon you to protect your intention from all the traces of seeking with your knowledge the pleasure of others besides Allaah, the Most High, yet it is incumbent to beware of the things which lead to these [evil qualities].
There are a number of sayings and occurrences that I mentioned at the beginning of the first chapter of my book at-Taaalum, and , I would also like to add to the previous list: the prohibition of the scholars on the issue of at-tubooliyaat meaning the [controversial] issues which are mentioned in order to achieve fame. It used to be said: 'the drums are struck for the mistake of a scholar,' and it was narrated that Sufyaan (ath-Thawree) رحمه الله said: 'I was blessed with the understanding of the Qur'aan, and when I upturned the money purse, it - i.e., understanding - was taken away from me.'
So hold fast - may Allaah shower His mercy upon you - to the most trustworthy handhold (sincerity) that will save you from these fatal blemishes, by becoming - along with exerting yourself in becoming sincere - very fearful of anything that nullifies it (sincerity), and displaying great poverty to Allaah سبحانه و تعالى, along with turning to Him sincerely. It was narrated that Sufyaan ibn Saeed ath-Thawree رحمه الله said: 'I did not treat anything more difficult than my sincerity.' It was narrated that Umar ibn Dharr رحمه الله said to his father رحمه الله: 'O, my father! Why is it when you preach to people they are taken by their weeping, and when others preach to them they do not cry?' So he replied: 'O, my son! The bereaved woman who cries is not the same as the woman who is hired to cry [over the dead].' May Allaah grant you prosperity in achieving the right guidance.
Secondly: The comprehensive quality that guarantees the goodness of this world and the hereafter is the love of Allaah, the Most High, and the love of His Messenger صلى الله عليه وسلم and realising them by genuine following, and pursuing the tracks of the infallible (i.e. the Prophet صلى الله عليه وسلم).
Allaah, the Most High, said:
'Say (O Muhammad صلى الله عليه وسلم to mankind): "If you (really) love Allaah then follow me (i.e. accept Islamic Monotheism, follow the Qur'aan and the Sunnah), Allaah will love you and forgive you of your sins. And Allaah is Oft-Forgiving, Most Merciful."' (Soorah Aali 'Imraan, 3:31)
Generally; this principle [is also considered] as the basis of this book, and its position is that of a crown to [mere] clothes.
So, O you seekers [of knowledge]! Here you are sitting cross legged for the lesson and your souls are attached to the most precious of things (seeking knowledge), so I advise myself and yourselves to fear Allaah, the Most High, openly and in secret; for indeed it is the tool, and the landing place of all virtue, the level of praiseworthiness, the source of power, and the ascension of the highly aspirated, and the most secure binding for the heart from the fitan (tribulations) so do not become negligent of it."
 Fataawa Ibn Taymiyyah (10/11,12,14,15,19,49-54), (11/314), (20/77-78).
 Hilyatu Taalibil-Ilm, translated into English by Abu Abdillah Murad ibn Hilmi Ash-Shuweikh, and published by Al Hidaayah Publishing, UK, under the title: 'The Etiquette of Seeking Knowledge.'
 The difference between these two is that the first category is when a person embarks upon seeking knowledge or any act of worship initially for the sake of pleasing others, in order to show off. As for the second category it is a shirk lesser that the first one and occurs during the act of worship.
Adh-Adhakheerah by al-Qaraafee (1/45) and refer to a splendid piece written by at-Tabaree in Tahdheeb al-Aathar (2/121-122) published by as-Safa, Makkah.
 With the intent of appearing to be more knowledgeable than your brothers or sisters and belittling them. However if one is free from such evil intentions, then it is required from the seeker of knowledge to exert him/herself and to compete with his/her brethren.
 As-Sawarim wal as-Sinnah by Abee Madyan ash-Shinqeetee as-Salafee, may Allaah shower His mercy upon him, also see Sharh al-lhyaa and Kunuz al-Ajdadp.263.
 Tadhkirat as-Saami wal Muta 'allim, p. 19.
 Al-Aqd al-Fareed by Ibn Abd Rabbihi.
 Shaykh Bakr Abu Zayd رحمه الله, The Etiquette of Seeking Knowledge (Al Hidaayah Publishing, UK), pp. 18-21.
See also: Virtues of Knowledge which is Learnt and Taught for the sake of Allah - https://www.muftisays.com/forums/12-virtues/5075-virtues-of-knowledge-which-is-learnt-and-taught-for-the-sake-of-allah.html