cpanel UAPI display Current User cPanel username
I have a great request for you
How using cpanel UAPI or cPanel API 2 display cpanel Current User username
for example - this code show ftp list
i need only show Current User cpanel username
[CODE=php]$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
// List FTP account information.
$list_ftp_accts = $cpanel->uapi(
'Ftp', 'list_ftp'
);
I can't find it in Developer + Documentation
I can't find it in Developer + Documentation
-
Please can you correct me [CODE=php]$cpanel = new CPANEL(); // Connect to cPanel - only do this once. //Retrieve user settings for example.com. $variables = $cpanel->uapi( 'Variables', 'get_user_information', array( 'name' => 'username', ) ); echo "$variables"; 0 -
Please can you correct me
The variable is `user`, so'name' => 'username',
should be'name' => 'user',
instead. See below: [CODE=perl]$cpanel = new CPANEL(); // Connect to cPanel - only do this once. //Retrieve user settings for example.com. $variables = $cpanel->uapi( 'Variables', 'get_user_information', array( 'name' => 'user', ) ); echo "$variables";0 -
I have create simple cpanel plugin with index.php file and code below [CODE=php] echo "testing" ; $cpanel = new CPANEL(); // Connect to cPanel - only do this once. //Retrieve user settings for example.com. $variables = $cpanel->uapi( 'Variables', 'get_user_information', array( 'name' => 'user', ) ); echo "$variables";
Output testing is visible but no Current User cpanel username visible $variables can you tell me please what's wrong in this script0 -
I put this code in the index.php plugin files and nothing works, I have a white screen :( 0 -
Hi @Jaro747 You have to be sure to traverse the tiers of data in the returned object. The return structure for this particular scenario is: - result
- data
- user
- data
0 - result
Please sign in to leave a comment.
Comments
6 comments