The Prophet ﷺ said, "Whoever acquires knowledge for other than Allah, or intends by it other than Allah, let him take his seat in the Fire."
حدثنا علي بن نصر بن علي حدثنا محمد بن عباد الهنائي حدثنا علي بن المبارك عن أيوب السختياني عن خالد بن دريك
عن النبي ﷺ قال من تعلم علما لغير الله أو أراد به غير الله فليتبوأ مقعده من النار
[Its chain of transmission is daif] Ibn Majah narrated it in the Introduction, chapter on benefiting from knowledge and acting upon it, Hadith: 258, from the hadith of Muhammad bin Abbad through the same chain. There is also a report on this topic from Jabir [Ibn Majah, Hadith: 254]. Khalid bin Durayk did not meet Ibn Umar.