cPanel Module deletes email and ftp accounts upon editing user's account (account settings) page
DigitalFrontier... - February 26, 2007 - 00:37
| Project: | Cpanel Integration |
| Version: | 4.7.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Module correctly creates accounts requested by users with the permissions to create their own email and ftp accounts, but if the go back to the account page (i.e., through "My Account") or other, previously created accounts are deleted upon submit even if email and ftp account weren't even touched. However, if password field is re-entered on the page then the accounts will not be deleted.
I think something is up with the last section of code from the function cPanel_user (around line 300):
/* ***********
if ($type == 'delete' && $account = user_load(array('uid' => $user->uid, 'status' => 1))) {
if ($cpanel_mail_domain != '' && variable_get('cpanel_mail_enabled', 0) && user_access('have email account', $user)) {
if (isset($account->cpanel_email) && $account->cpanel_email) {
$ret = _cpanel_handle_request('/frontend/x/mail/realdelpop.html', array('email' => $cpanel_username, 'domain' => $cpanel_mail_domain));
if (!$ret) {
watchdog('user', t('Error deleting cPanel email account <em>%username@%domain</em>', array('%username' => $cpanel_username, '%domain' => $cpanel_mail_domain)), WATCHDOG_ERROR);
} else {
watchdog('user', t('Deleted cPanel email account <em>%username@%domain</em>' , array('%username' => $cpanel_username, '%domain' => $cpanel_mail_domain)), WATCHDOG_NOTICE);
}
}
}
if ($cpanel_ftp_domain != '' && variable_get('cpanel_ftp_enabled', 0) && user_access('have FTP account', $user)) {
if (isset($account->cpanel_ftp) && $account->cpanel_ftp) {
$ret = _cpanel_handle_request('/frontend/x/ftp/realdodelftp.html', array('login' => $cpanel_username));
if (!$ret) {
watchdog('user', t('Error deleting cPanel FTP account <em>%username@%domain</em>', array('%username' => $cpanel_username, '%domain' => $cpanel_ftp_domain)), WATCHDOG_ERROR);
} else {
watchdog('user', t('Deleted cPanel FTP account <em>%username@%domain</em>' , array('%username' => $cpanel_username, '%domain' => $cpanel_ftp_domain)), WATCHDOG_NOTICE);
}
}
}
}
*********** */Commenting out these lines seemed to get rid of the bug for me.
Stephen

#1
I was afraid the above code was not the answer since the $op is "delete" and it wasn't the answer. Further testing shows that accounts are deleted anyway upon updates. I've simply commented out the $ret sections sending the delete commands to file.inc for the time being.
#2
I posted an updated version of the module here: http://drupal.org/node/103336#comment-1124347
It is for drupal 5.x