require_once('lib/base.php'); \OC_Util::checkLoggedIn(); $user = \OC::$server->getUserSession()->getUser(); $displayName = \OC_User::getDisplayName($user->getUID()); echo "Display Name: ".$displayName;
require_once('lib/base.php'); $uid = "john"; $displayName = \OC_User::getDisplayName($uid); echo "John's Display Name: ".$displayName;In this example, the display name of the user with the username "john" is retrieved and printed on the screen. Package library: ownCloud core package.