It is narrated from Hazrat Anas (may Allah be pleased with him) that a funeral passed in front of the Prophet (peace and blessings be upon him), and someone praised the deceased, and the people praised him. The Prophet (peace and blessings be upon him) said twice, "It has become obligatory." Then another funeral passed, and the people criticized the deceased. The Prophet (peace and blessings be upon him) again said twice, "It has become obligatory." Hazrat Umar (may Allah be pleased with him) said, "May my parents be sacrificed for you! The first funeral passed, and the people praised the deceased, and you said twice, 'It has become obligatory.' And when the second funeral passed and the people criticized the deceased, you again said twice, 'It has become obligatory.'?" The Prophet (peace and blessings be upon him) said, "Whomsoever you praise, Paradise becomes obligatory for him, and whomsoever you criticize, Hell becomes obligatory for him." And, "You are Allah's witnesses on earth."
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 13996