The Prophet (ﷺ) decided regarding one who was treated as a member of a family after the death of his father, to whom he was attributed when the heirs said he was one of them, that if he was the child of a slave-woman whom the father owned when he had intercourse with her, he was included among those who sought his inclusion, but received none of the inheritance which was previously divided; he, however, received his portion of the inheritance which had not already been divided; but if the father to whom he was attributed had disowned him, he was not joined to the heirs.
If he was a child of a slave-woman whom the father did not possess or of a free woman with whom he had illicit intercourse, he was not joined to the heirs and did not inherit even if the one to whom he was attributed is the one who claimed paternity, since he was a child of fornication whether his mother was free or a slave.
Sunan Abi Dawud Book 13, Hadith 91
That when he went to 'Umar during his Caliphate. 'Umar said to him,
"Haven't I been told that you do certain jobs for the people but when
you are given payment you refuse to take it?" 'Abdullah added: I said,
"Yes." 'Umar said, "Why do you do so?" I said, "I have horses and
slaves and I am living in prosperity and I wish that my payment should
be kept as a charitable gift for the Muslims." 'Umar said, "Do not do
so, for I intended to do the same as you do. Allah's Messenger (ﷺ)s used to
give me gifts and I used to say to him, 'Give it to a more needy one
than me.' Once he gave me some money and I said, 'Give it to a more
needy person than me,' whereupon the Prophet (ﷺ) said, 'Take it and keep
it in your possession and then give it in charity. Take what ever
comes to you of this money if you are not keen to have it and not
asking for it; otherwise (i.e., if it does not come to you) do not
seek to have it yourself.' "
Sahih al-Bukhari Book 93, Hadith 27