
To load the author name or owner from a node entity object we can use getOwner(). The below example show how to load a node object using node id and to get the Author name from it.
Sample code:
$entity_obj = entity_load('node', 7); $author_name = $entity_obj->getOwner()->getDisplayName(); print_r(‘The author name is : ’ . $author_name);
Result:
The author name is : Anishnirmal
Category: