Want to offer your members a FREE email address, below is a simple code to automatically set up an email address when members confirms email address.
Edit /profile_activate.php
FIND $update = db_res( "UPDATE `Profiles` SET `Status` = '$status' WHERE `ID` = '$ID';" );
AND ABOVE PUT THE FOLLOWING CODE and REMEMBER TO CHANGE THE BLUE TEXT:
require_once( BX_DIRECTORY_PATH_INC . 'xmlapi.php' );
$ip = '127.0.0.1'; //the ip address of your email hosting
$root_pass = 'ROOTPASSWORD'; //password for cPanel account
$account = 'CPanelUSERNAME'; //account name for cPanel
$email_user = $p_arr['NickName']; //the email account to be created, portion before @
$email_password = 'DEFAULTPASSWORD'; //the password to be used for the new email account
$dest_email = $p_arr['Email']; //the full email account to be forwarded to
$email_domain = 'DOMAINNAME; //the email domain (part of email after @)
$email_quota = '10'; //the mailbox quota for the new account in MB
$final_email = $p_arr['NickName'].'@YOURDOMAIN.COM';
// don't change anything from here forward
$xmlapi = new xmlapi($ip);
$xmlapi->set_port(2083);
$xmlapi->password_auth($account,$root_pass);
$xmlapi->set_output('xml');
$result = $xmlapi->api1_query($account, 'Email', 'addpop', array($email_user, $email_password, $email_quota, $email_domain) );
$result_forward = $xmlapi->api2_query($account, 'Email', 'addforward', array(domain => $email_domain, email => $email_user, fwdopt => 'fwd', fwdemail => $dest_email) );
$update = db_res( "UPDATE `Profiles` SET `Email` = '$final_email' WHERE `ID` = '$ID';" );
createUserDataFile($p_arr['Email']);
reparseObjTags('profile', $p_arr['Email']);
UPLOAD THE ATTACHED API TO YOUR /INC DIRECTORY
CLEAR THE CACHE
NOTES:
If you don't want to update the email address then create an additional field in PhpMyAdmin in the PROFILE table and use the following code:
$update = db_res( "UPDATE `Profiles` SET `PROFILEFIELD` = '$final_email' WHERE `ID` = '$ID';" );
createUserDataFile($p_arr['Email']);
reparseObjTags('profile', $p_arr['Email']);
Then you can create a box to display the new email address.
That's It