All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad is His slave and Messenger.
It is only Allaah, the Knower of the Unseen, who knows what is in the heart of the person. We judge people according to what is apparent, and Allaah knows what is hidden in their hearts.
The Prophet said, “I have been ordered to fight the people until they testify that there is none worthy of worship except Allaah and that Muhammad is the Messenger of Allaah and until they establish the prayer and pay the zakah. If they do so, they will have gained protection from me for their lives and property, unless (they commit acts that are punishable) in accordance to Islam, and their reckoning will be with Allaah Almighty;” that is to say, in matters regarding what is hidden.
Ibn Rajab said, "As for the Hereafter, Allaah will hold the person accountable; if he is truthful, Allaah will admit him to Paradise, and if he is a liar, then he will be among the hypocrites in the lowest level of the Hellfire."
Ibn Hajar said in Fat-h al-Baari: "Meaning what is hidden in their hearts … and this hadeeth is evidence for accepting the apparent actions and to judge according to what is necessitated by what is apparent."
Anas ibn Maalik said, “The Prophet said, 'Whoever prays like us and faces our qiblah (prayer direction) and eats our slaughtered animals is a Muslim and is under Allaah's protection and His Messenger's Protection. So do not betray Allaah by betraying those who are in His Protection.'” [Al-Bukhari]
Al-Khattaabi said in A’laam Al-Hadeeth, “This hadeeth teaches us that the matters of the people in their dealing between each other are judged according to what is apparent from their states apart from what is hidden. Whoever shows the signs of religion and the traits of its followers, then he is judged (by the Muslims) according to what is apparent from him, and what is hidden in his heart is not to be investigated.”
What also demonstrates the same meaning is the saying of the Prophet to Usaamah, “Did you open his heart to know……” [Muslim]
On the other hand, the saying of ‘Umar which you referred to in the question says:
“People were judged by the revelation [which shows the ruling about what they did] during the lifetime of the Prophet but now there is no longer any revelation. Now we judge you by the deeds that you practice publicly, so we will trust and favor the one who does good deeds in front of us, and we will not call him to account about what he is really doing in secret, for Allaah will judge him for that; meanwhile, we will not trust or believe the one who appears to us with an evil deed, even if he claims that his intentions were good.” [Al-Bukhari]
These and other texts show that this rule is correct, that we judge the people according to what is apparent to us from them, and what is hidden from them is entrusted to Allaah, the Knower of the Unseen.
Combining the two points is acceptable while taking into account that the meaning should not be misinterpreted, and there is no great need in doing so.
Allaah knows best.