Harmalah bin Yahya (rahimahullah) reports:
I once heard Imaam Shaafi‘ee (rahimahullah) mention the following in regard to purifying and illuminating the heart through which it will be easy for one to understand Deen:
“The one who wishes that Allah Ta‘ala should open and illuminate his heart (with deep understanding and profound knowledge), then he should hold firmly onto the following qualities; refraining from discussing that which does not concern him, leaving out all sins and abstaining from all forms of disobedience. Furthermore, he should carry out righteous actions which should be only between him and Allah Ta‘ala (i.e. with ikhlaas and without publicizing them before anyone). When one does this, then Allah Ta‘ala will bless him with such profound ‘ilm that he will remain immersed in it and it will safeguard him from becoming involved in other occupations of the world. Similarly, he will be concerned about his end which will keep him away from all other futile pursuits (i.e. the preparation for death and the Hereafter will safeguard him from getting involved in unbeneficial actions).”
(Manaaqib-ush-Shaafi‘ee li-lBayhaqi vol. 2 pg. 171)