// Load the OC_User package library \OCP\User::checkLoggedIn(); \OC::$server->getNavigationManager()->setActiveEntry('core_users_index'); $users = \OC_User::getUsers(); foreach ($users as $user) { echo $user . "
"; }
// Load the OC_User package library \OCP\User::checkLoggedIn(); \OC::$server->getNavigationManager()->setActiveEntry('core_users_index'); $username = "JohnDoe"; $userExists = \OC_User::userExists($username); if ($userExists) { echo "User " . $username . " exists!"; } else { echo "User " . $username . " does not exist!"; }Here, the userExists() method is used to check whether the user with the username "JohnDoe" exists in ownCloud. If the user exists, a message is displayed stating that the user exists. Otherwise, another message is displayed stating that the user does not exist. Overall, the OC_User package library is a helpful tool for managing users in ownCloud applications. Its getUsers() method is just one of many useful methods in the package that can aid in user management.