Just compare display names:
$currentuser = get_currentuserinfo();
if ( get_the_author() == $currentuser->displayname ) {
// current user is the post author; do something
}
The get_the_author()
function returns displayname
, which should be able to be compared against the displayname
parameter that is a part of the $currentuser
object.