Skip to main content

get cpanel username

Comments

4 comments

  • cPanelMichael
    What I wanted to do is, this script will automatically select username for which I am create cpanel user

    Hello, Could you elaborate a bit further on what you are attempting to configure? Thank you.
    0
  • tecwithquestion
    Hello I used below script in postwwwacct .'"; $databasename = 'dbbb';//do not prepend with username $databaseuser = 'dbbb';//api will do that for you $databasepass = 'P3cJdlvx/vAo5cSRR5djAA=='; $xmlapi = new xmlapi($db_host); $xmlapi->password_auth("root","rootpass"); $xmlapi->set_debug(1);//this setting will put output into the error log in the directory that you are calling script from $xmlapi->set_output('array');//set this for browser output //create database $createdb = $xmlapi->api1_query($cpuser, "Mysql", "adddb", array($databasename)); foreach($createdb as $v) { $result = $v['result">; } if ($result == 1) { //create user $usr = $xmlapi->api1_query($cpuser, "Mysql", "adduser", array($databaseuser, $databasepass)); } foreach($usr as $v) { $result2 = $v['result">; } if ($result2 == 1) { //add user to database $addusr = $xmlapi->api1_query($cpuser, "Mysql", "adduserdb", array($databasename, $databaseuser, 'all')); } print_r($addusr); ?>
    0
  • tecwithquestion
    Bascially I want to install wordpress automatically if custom package is selected in whm. It will work if I am able to get username which is being used for creating cpanel account
    0
  • cPanelMichael
    Hello, It's likely a good idea to start using standardized hooks: This event returns the WHM API 1 createacct function's input parameters and values. Thank you.
    0

Please sign in to leave a comment.