Can Anyone Other than Allah Know the Unseen?
Question

From surah jinn 72:26,27,28 verses, it is clear that Allah does not disclose his unseen to anyone except whom he has approved of messengers. But,the verses in surah Hud 11:71,72 and surah Maryam 19:16-19 indicates that Allah disclose his unseen not only for the messengers but also for the \'Awliyas\' of Allah. Then,how we can interpret the verses in surah jinn 72:26,27,28 ? Some says that the verses in surah Hud and Maryam tells about the birth of messengers. So, it comes under muhijisah and others says that Allah disclose the unseen to whomever he wills.By this,I am very much confused.
Praise be to Allah.Types of the Unseen in Islam
The unseen (al-ghayb) is of two types:
1- That which is absolutely unseen and unknown. No one knows this type except Allah . For example, this includes knowledge of when the Hour will begin, when rain will fall, and so on.
2- That which is relatively unseen and unknown, knowledge of which is hidden from some people and others know it. This is described as unseen or unknown in relation to the one who does not know it, and it is not unknown or unseen for the one who does know it.
A person may learn of that which is relatively unseen either through revelation, or through life experience, or through empirical science, or other means through which he may come to know of that which is hidden from many people, such as finding out about what is in the depths of the oceans, or in the caves of the earth or in the heavens.
Ibn Taymiyah said: 
“As for that which some people know, it is unseen (ghayb) for those who do not know it, and it is seen for those who do know it.” (An-Nubuwwat, 2/1022)
Commentary on al-Jinn 72:26-27
With regard to the verses (interpretation of the meaning):
{[He is] Knower of the unseen, and He does not disclose His [knowledge of the] unseen to anyone, except whom He has approved of messengers.} [al-Jinn 72:26-27], Ibn Kathir said: 
“{Knower of the unseen, and He does not disclose His [knowledge of the] unseen to anyone, except whom He has approved of messengers} – this is like the verse in which He, may He be exalted, says: {and they encompass not a thing of His knowledge except for what He wills.} [al-Baqarah 2:255]
Similarly, He says here that He knows the unseen and the seen, and that none of His creation can learn about anything of His knowledge except what He, may He be exalted, discloses to him. Hence He says: {and He does not disclose His [knowledge of the] unseen to anyone, except whom He has approved of messengers}.
This includes both angelic and human messengers.” (Tafsir Ibn Kathir, 8/247)
Ibn ‘Ashur said: 
“Allah discloses some things to some of His Messengers because of the message that He wants to send to humankind.
Thus we may know that the unseen matters that Allah discloses to the messengers are of a type that is part of the message; these are: matters of the unseen that Allah wanted to convey to people so that they might believe in them, or act upon them; the unseen matters that have to do with the promise of reward and threat of punishment, which have to do with matters of the Hereafter or matters of this world; and what Allah tells His messengers about of matters of the unseen as proof that they are indeed messengers, such as the verses in which He, may He be exalted, says (interpretation of the meaning): 
{The Byzantines have been defeated in the nearest land. But they, after their defeat, will overcome within three to nine years.} [ar-Rum 30:2-4]
The purpose behind that is so that the messengers will acquire certain, clear and beneficial knowledge, as if they had seen these matters themselves.” (At-Tahrir wa’t-Tanwir, 29/248)
With regard to what is granted to some of the righteous of knowledge of some unseen matters, it is by way of karamah (honouring them) and may be granted by some of them by way of inspiration and the like.
Shaykh al-Islam said: 
“The miracles and signs of the awliya (close friends of Allah) are part of the miracles and signs of the prophets, because they definitely confirm the prophethood of the prophets and confirm that they are indeed true prophets. Were that not the case, these people would not be awliya and they would not have any miracles (karamat ).” (An-Nubuwwat, 2/824)
Some of the scholars stated that letting the awliya find out about some matters of the unseen could happen through the angels, so it is like us learning about the events of the Hereafter, which is a matter of the unseen, through the messengers. Thus when we speak of it, it is not the same as when the messengers speak of it.
Types of revelation (wahy)
With regard to the verses referred to, there is nothing in them about learning about the unseen; rather they refer to inspiration that is granted to some of the awliya. Perhaps this is the source of the questioner’s confusion, because the verses speak of wahy being given to someone other than the prophets.
The response to that is as follows:
Wahy (revelation, inspiration) is of two types:
1. Wahy in a special sense (revelation), which is the sending of an angelic messenger to a prophet or messenger.
2. Wahy in a general sense (inspiration), which is what happens to some of the awliya, and to the angels, and to some created beings; this happens through inspiration, dreams, and so on.
Shaykh al-Islam said: 
“Not everyone who receives wahy in the general sense (inspiration) is a prophet, for wahy (inspiration) may be sent to other people.” (An-Nubuwwat, 2/690)
And he said: 
“Similarly, the word wahy may be used in a general sense (meaning inspiration)…
Wahy in the general sense is what may happen to some individuals.” (Majmu‘at al-Masail, Rashid Rida, 3/96)
And Allah knows best.