User

To retrieve data about Plesk user, use the pm_Client class.

The pm_Client class represents a Plesk user account. This class supports retrieving information about a user either by their ID or by their username. It also lets you identify a user's account type: administrator, reseller, or customer. Finally, this class contains the getProperty() method that lets you retrieve any user information from the clients table in the Plesk database psa.

Examples

Retrieve information about the user

You can retrieve user information by their ID and identify their username and account type by using the methods:

Use the following code:

$client = pm_Client::getByClientId($id);
echo "Hello, {$client->getProperty('login')}";
if ($client->isAdmin()) {
	echo "You are admin";
} elseif ($client->isReseller()) {
	echo "You are reseller";
} elseif ($client->isClient()) {
	echo "You are customer";
}
Retrieve user ID by username

To retrieve user ID by their username, use the method

Use the following code:

$client = pm_Client::getByLogin($login);
echo "Your ID is {$client->getId()}";
 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.