'.
__('The information size you were trying to submit was larger than', 'profilebuilder') .' '. ServerMaxUploadSizeMega .'b!
'.
__('This is usually caused by a large file(s) trying to be uploaded.', 'profilebuilder') .'
'.
__('Since it was also larger than', 'profilebuilder') .' '. ServerMaxPostSizeMega .'b, '. __('no additional information is available.', 'profilebuilder'). '
'.
__('The user was NOT created!', 'profilebuilder') .
'
';
$registerFilterArray['noPostError'] = apply_filters('wppb_register_no_post_error_message', $registerFilterArray['noPostError']);
echo $registerFilterArray['noPostError'];
}
/* If user registered, input info. */
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'adduser' && wp_verify_nonce($_POST['register_nonce_field'],'verify_true_registration') ) {
//global $wp_roles;
//get value sent in the shortcode as parameter, default to "subscriber" if not set
extract(shortcode_atts(array('role' => 'subscriber'), $atts));
//check if the specified role exists in the database, else fall back to the "safe-zone"
$found = get_role($role);
if ($found != null)
$aprovedRole = $role;
else $aprovedRole = get_option( 'default_role' );
$user_pass = esc_attr( $_POST['passw1'] );
/* use filters to modify (if needed) the posted data before creating the user-data */
$user_pass = apply_filters('wppb_register_posted_password', $user_pass);
$_POST['user_name'] = apply_filters('wppb_register_posted_email', $_POST['user_name']);
$_POST['first_name'] = apply_filters('wppb_register_posted_first_name', $_POST['first_name']);
$_POST['last_name'] = apply_filters('wppb_register_posted_last_name', $_POST['last_name']);
$_POST['nickname'] = apply_filters('wppb_register_posted_nickname', $_POST['nickname']);
$_POST['email'] = apply_filters('wppb_register_posted_email', $_POST['email']);
$_POST['website'] = apply_filters('wppb_register_posted_website', $_POST['website']);
$_POST['aim'] = apply_filters('wppb_register_posted_aim', $_POST['aim']);
$_POST['yim'] = apply_filters('wppb_register_posted_yahoo', $_POST['yim']);
$_POST['jabber'] = apply_filters('wppb_register_posted_jabber', $_POST['jabber']);
$_POST['description'] = apply_filters('wppb_register_posted_bio', $_POST['description']);
/* END use filters to modify (if needed) the posted data before creating the user-data */
$userdata = array(
'user_pass' => $user_pass,
'user_login' => esc_attr( $_POST['user_name'] ),
'first_name' => esc_attr( $_POST['first_name'] ),
'last_name' => esc_attr( $_POST['last_name'] ),
'nickname' => esc_attr( $_POST['nickname'] ),
'user_email' => esc_attr( $_POST['email'] ),
'user_url' => esc_attr( $_POST['website'] ),
'aim' => esc_attr( $_POST['aim'] ),
'yim' => esc_attr( $_POST['yim'] ),
'jabber' => esc_attr( $_POST['jabber'] ),
'description' => esc_attr( $_POST['description'] ),
'role' => $aprovedRole);
//get required and shown fields
$wppb_defaultOptions = get_option('wppb_default_settings');
//check if the user agreed to the terms and conditions (if it was set)
$wppb_premium = wppb_plugin_dir . '/premium/functions/';
if (file_exists ( $wppb_premium.'extra.fields.php' )){
$wppbFetchArray = get_option('wppb_custom_fields');
foreach ( $wppbFetchArray as $key => $value){
switch ($value['item_type']) {
case "agreeToTerms":{
$agreed = false;
if ( (isset($_POST[$value['item_id'].$value['id']] )) && ($_POST[$value['item_id'].$value['id']] == 'agree'))
$agreed = true;
break;
}
}
}
}
$registerFilterArray['extraError'] = ''; //this is for creating extra error message and bypassing registration
$registerFilterArray['extraError'] = apply_filters('wppb_register_extra_error', $registerFilterArray['extraError']);
/* check if all the required fields were completed */
if($wppb_defaultOptions['firstname'] == 'show'){
if (($wppb_defaultOptions['firstnameRequired'] == 'yes') && (trim($_POST['first_name']) == ''))
$firstnameComplete = 'no';
}elseif($wppb_defaultOptions['lastname'] == 'show'){
if (($wppb_defaultOptions['lastnameRequired'] == 'yes') && (trim($_POST['last_name']) == ''))
$lastnameComplete = 'no';
}elseif($wppb_defaultOptions['nickname'] == 'show'){
if (($wppb_defaultOptions['nicknameRequired'] == 'yes') && (trim($_POST['nickname']) == ''))
$nicknameComplete = 'no';
}elseif($wppb_defaultOptions['website'] == 'show'){
if (($wppb_defaultOptions['websiteRequired'] == 'yes') && (trim($_POST['website']) == ''))
$websiteComplete = 'no';
}elseif($wppb_defaultOptions['aim'] == 'show'){
if (($wppb_defaultOptions['aimRequired'] == 'yes') && (trim($_POST['aim']) == ''))
$aimComplete = 'no';
}elseif($wppb_defaultOptions['yahoo'] == 'show'){
if (($wppb_defaultOptions['yahooRequired'] == 'yes') && (trim($_POST['yahoo']) == ''))
$yahooComplete = 'no';
}elseif($wppb_defaultOptions['jabber'] == 'show'){
if (($wppb_defaultOptions['jabberRequired'] == 'yes') && (trim($_POST['jabber']) == ''))
$jabberComplete = 'no';
}elseif($wppb_defaultOptions['bio'] == 'show'){
if (($wppb_defaultOptions['bioRequired'] == 'yes') && (trim($_POST['description']) == ''))
$bioComplete = 'no';
}
// check the extra fields also
$wppb_premium = wppb_plugin_dir . '/premium/functions/';
if (file_exists ( $wppb_premium.'extra.fields.php' )){
$wppbFetchArray = get_option('wppb_custom_fields');
foreach ( $wppbFetchArray as $key => $value){
switch ($value['item_type']) {
case "input":{
$_POST[$value['item_id'].$value['id']] = apply_filters('wppb_register_input_custom_field_'.$value['id'], $_POST[$value['item_id'].$value['id']]);
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes'){
if (trim($_POST[$value['item_id'].$value['id']]) == '')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
case "checkbox":{
$checkboxOption = '';
$checkboxValue = explode(',', $value['item_options']);
foreach($checkboxValue as $thisValue){
$thisValue = str_replace(' ', '#@space@#', $thisValue); //we need to escape the space-codification we sent earlier in the post
if (isset($_POST[$thisValue.$value['id']])){
$localValue = str_replace('#@space@#', ' ', $_POST[$thisValue.$value['id']]);
$checkboxOption = $checkboxOption.$localValue.',';
}
}
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes'){
if (trim($checkboxOption) == '')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
case "radio":{
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes'){
if (trim($_POST[$value['item_id'].$value['id']]) == '')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
case "select":{
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes'){
if (trim($_POST[$value['item_id'].$value['id']]) == '')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
case "countrySelect":{
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes'){
if (trim($_POST[$value['item_id'].$value['id']]) == '')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
case "timeZone":{
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes'){
if (trim($_POST[$value['item_id'].$value['id']]) == '')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
case "datepicker":{
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes'){
if (trim($_POST[$value['item_id'].$value['id']]) == '')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
case "textarea":{
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes'){
if (trim($_POST[$value['item_id'].$value['id']]) == '')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
case "upload":{
$uploadedfile = $value['item_type'].$value['id'];
if ( (basename( $_FILES[$uploadedfile]['name']) == '')){
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
case "avatar":{
$uploadedfile = $value['item_type'].$value['id'];
if ( (basename( $_FILES[$uploadedfile]['name']) == '')){
if (($_FILES[$uploadedfile]['type'] != 'image/jpeg') || ($_FILES[$uploadedfile]['type'] != 'image/jpg') || ($_FILES[$uploadedfile]['type'] != 'image/png') || ($_FILES[$uploadedfile]['type'] != 'image/bmp') || ($_FILES[$uploadedfile]['type'] != 'image/pjpeg') || ($_FILES[$uploadedfile]['type'] != 'image/x-png'))
if ($value['item_required'] != null){
if ($value['item_required'] == 'yes')
array_push($extraFieldsErrorHolder, $value['id']);
}
}
break;
}
}
}
}
/* END check if all the required fields were completed */
if ($registerFilterArray['extraError'] != '')
$error = $registerFilterArray['extraError'];
elseif ( !$userdata['user_login'] )
$error = __('A username is required for registration.', 'profilebuilder');
elseif ( username_exists($userdata['user_login']) )
$error = __('Sorry, that username already exists!', 'profilebuilder');
elseif ( !is_email($userdata['user_email'], true) )
$error = __('You must enter a valid email address.', 'profilebuilder');
elseif ( email_exists($userdata['user_email']) )
$error = __('Sorry, that email address is already used!', 'profilebuilder');
elseif (( empty($_POST['passw1'] ) || empty( $_POST['passw2'] )) || ( $_POST['passw1'] != $_POST['passw2'] )){
if ( empty($_POST['passw1'] ) || empty( $_POST['passw2'] )) //verify if the user has completed both password fields
$error = __('You didn\'t complete one of the password-fields!', 'profilebuilder');
elseif ( $_POST['passw1'] != $_POST['passw2'] ) //verify if the the password and the retyped password are a match
$error = __('The entered passwords don\'t match!', 'profilebuilder');
}
elseif ( $agreed == false )
$error = __('You must agree to the terms and conditions before registering!', 'profilebuilder');
elseif(($firstnameComplete == 'no' || $lastnameComplete == 'no' || $nicknameComplete == 'no' || $websiteComplete == 'no' || $aimComplete == 'no' || $yahooComplete == 'no' || $jabberComplete == 'no' || $bioComplete == 'no' ) || !empty($extraFieldsErrorHolder))
$error = __('The account was NOT created!', 'profilebuilder') .'
display_name == ''){
$login->display_name = $login->user_login;
}
$registerFilterArray['loginLogoutError'] = '
'. __('You are logged in as', 'profilebuilder') .' '.$login->display_name.'. '. __('You don\'t need another account.', 'profilebuilder') .' '. __('Logout', 'profilebuilder') .' »
';
$registerFilterArray['loginLogoutError'] = apply_filters('wppb_register_have_account_alert', $registerFilterArray['loginLogoutError']);
echo $registerFilterArray['loginLogoutError'];
elseif ( $new_user != 'no' ) :
if ( current_user_can( 'create_users' ) ){
$registerFilterArray['registrationMessage1'] = '
'. __('A user account has been created for', 'profilebuilder') .' '. $registered_name. '.
';
$registerFilterArray['registrationMessage1'] = apply_filters('wppb_register_account_created1', $registerFilterArray['registrationMessage1']);
echo $registerFilterArray['registrationMessage1'];
$wppb_addons = wppb_plugin_dir . '/premium/addon/';
if (file_exists ( $wppb_addons.'addon.php' )){
//check to see if the redirecting addon is present and activated
$wppb_premium_addon_settings = get_option('wppb_premium_addon_settings');
if ($wppb_premium_addon_settings['customRedirect'] == 'show'){
//check to see if the redirect location is not an empty string and is activated
$customRedirectSettings = get_option('customRedirectSettings');
if ((trim($customRedirectSettings['afterRegisterTarget']) != '') && ($customRedirectSettings['afterRegister'] == 'yes')){
$redirectLink = trim($customRedirectSettings['afterRegisterTarget']);
$findHttp = strpos($redirectLink, 'http');
if ($findHttp === false)
$redirectLink = 'http://'. $redirectLink;
}
}
}
$registerFilterArray['redirectMessage1'] = '
You will soon be redirected automatically. If you see this page for more than 3 second, please click here.';
$registerFilterArray['redirectMessage1'] = apply_filters('wppb_register_redirect_after_creation1', $registerFilterArray['redirectMessage1']);
echo $registerFilterArray['redirectMessage1'];
}else{
$registerFilterArray['registrationMessage2'] = '
'. __('Thank you for registering', 'profilebuilder') .' '. $registered_name .'.
';
$registerFilterArray['registrationMessage2'] = apply_filters('wppb_register_account_created2', $registerFilterArray['registrationMessage2']);
echo $registerFilterArray['registrationMessage2'];
$wppb_addons = wppb_plugin_dir . '/premium/addon/';
if (file_exists ( $wppb_addons.'addon.php' )){
//check to see if the redirecting addon is present and activated
$wppb_premium_addon_settings = get_option('wppb_premium_addon_settings');
if ($wppb_premium_addon_settings['customRedirect'] == 'show'){
//check to see if the redirect location is not an empty string and is activated
$customRedirectSettings = get_option('customRedirectSettings');
if ((trim($customRedirectSettings['afterRegisterTarget']) != '') && ($customRedirectSettings['afterRegister'] == 'yes')){
$redirectLink = trim($customRedirectSettings['afterRegisterTarget']);
$findHttp = strpos($redirectLink, 'http');
if ($findHttp === false)
$redirectLink = 'http://'. $redirectLink;
}
}
}
$registerFilterArray['redirectMessage2'] = '
You will soon be redirected automatically. If you see this page for more than 3 second, please click here.';
$registerFilterArray['redirectMessage2'] = apply_filters('wppb_register_redirect_after_creation2', $registerFilterArray['redirectMessage2']);
echo $registerFilterArray['redirectMessage2'];
}
if(isset($_POST['send_credentials_via_email'])){
if ($sentEmailStatus == 1){
$registerFilterArray['emailMessage1'] = '
'. __('An error occured while trying to send the notification email.', 'profilebuilder') .'
';
$registerFilterArray['emailMessage1'] = apply_filters('wppb_register_send_notification_email_fail', $registerFilterArray['emailMessage1']);
echo $registerFilterArray['emailMessage1'];
}elseif ($sentEmailStatus == 2){
$registerFilterArray['emailMessage2'] = '
'. __('An email containing the username and password was successfully sent.', 'profilebuilder') .'
';
$registerFilterArray['emailMessage2'] = apply_filters('wppb_register_send_notification_email_success', $registerFilterArray['emailMessage2']);
echo $registerFilterArray['emailMessage2'];
}
}
?>
'. $error .'';
$registerFilterArray['errorMessage'] = apply_filters('wppb_register_error_messaging', $registerFilterArray['errorMessage']);
echo $registerFilterArray['errorMessage'];
endif;
if ( current_user_can( 'create_users' ) && $registration ) :
$registerFilterArray['alertMessage1'] = '
'. __('Users can register themselves or you can manually create users here.', 'profilebuilder') .'
';
$registerFilterArray['alertMessage1'] = apply_filters('wppb_register_alert_messaging1', $registerFilterArray['alertMessage1']);
echo $registerFilterArray['alertMessage1'];
elseif ( current_user_can( 'create_users' ) ) :
$registerFilterArray['alertMessage2'] = '
'. __('Users cannot currently register themselves, but you can manually create users here.', 'profilebuilder') .'
';
$registerFilterArray['alertMessage2'] = apply_filters('wppb_register_alert_messaging2', $registerFilterArray['alertMessage2']);
echo $registerFilterArray['alertMessage2'];
elseif ( !current_user_can( 'create_users' ) && !$registration) :
$registerFilterArray['alertMessage3'] = '
'. __('Only an administrator can add new users.', 'profilebuilder') .'
';
$registerFilterArray['alertMessage3'] = apply_filters('wppb_register_alert_messaging3', $registerFilterArray['alertMessage3']);
echo $registerFilterArray['alertMessage3'];
endif;
if ( $registration || current_user_can( 'create_users' ) ) :
/* use this action hook to add extra content before the register form. */
do_action( 'wppb_before_register_fields' );
?>