Hello all.
I have a master reseller account under which customer accounts are registered. I would like to add addon domains to these customer accounts using a cpanel instance authenticated with the master reseller account.
This is trivially done using the web interface. However, when I try to do it using the cpanel sdk/api2, I can only add the addon domain to the reseller account itself, not its sub-accounts.
I'm using PHP. Here's the relevant code-snippet adding the addon domain. I understand that the api call used doesn't have the "user" parameter which I was lead to believe it had, and that this is the reason the domain is added to the reseller:
So, the question is, how can I have this effect the sub-account (here contained in $usr) instead of the reseller accounts?
I have searched wide and far already, but I have yet to find something that actually solves the problem.
Any help or tips will be greatly appreciated. Thank you!
Regards,
devel
I have a master reseller account under which customer accounts are registered. I would like to add addon domains to these customer accounts using a cpanel instance authenticated with the master reseller account.
This is trivially done using the web interface. However, when I try to do it using the cpanel sdk/api2, I can only add the addon domain to the reseller account itself, not its sub-accounts.
I'm using PHP. Here's the relevant code-snippet adding the addon domain. I understand that the api call used doesn't have the "user" parameter which I was lead to believe it had, and that this is the reason the domain is added to the reseller:
Code:
...
$cpCfg = array(
'cpanel'=>array(
'service'=>array(
'cpanel' => array(
'host' => $ip,
'user' => $rusr,
'password' => $rpw,
)
)
)
);
$cp = Cpanel_PublicAPI::getInstance($cpCfg);
$queryMF = array(
'module' => 'AddonDomain',
'function' => 'addaddondomain',
);
$queryArgs = array(
'user' => $usr,
'dir' => $domain,
'newdomain' => $domain,
'subdomain' => $domain
);
$response = $cp->cpanel_api2_request('cpanel', $queryMF, $queryArgs);
...
I have searched wide and far already, but I have yet to find something that actually solves the problem.
Any help or tips will be greatly appreciated. Thank you!
Regards,
devel