function wppb_front_end_logout($atts) { if (!is_user_logged_in()) { return; } $current_user = get_userdata(get_current_user_id()); extract(shortcode_atts(array('text' => sprintf(__('You are currently logged in as %s. ', 'profilebuilder'), $current_user->user_login), 'redirect' => wppb_curpageurl(), 'link_text' => __('Log out »', 'profilebuilder')), $atts)); $logout_link = '<a href="' . wp_logout_url($redirect) . '" class="wppb-logout-url" title="' . __('Log out of this account', 'profilebuilder') . '">' . $link_text . '</a>'; $meta_tags = apply_filters('wppb_front_end_logout_meta_tags', array('{{meta_user_name}}', '{{meta_first_name}}', '{{meta_last_name}}', '{{meta_display_name}}')); $meta_tags_values = apply_filters('wppb_front_end_logout_meta_tags_values', array($current_user->user_login, $current_user->first_name, $current_user->last_name, $current_user->display_name)); $text = apply_filters('wppb_front_end_logout_text', str_replace($meta_tags, $meta_tags_values, $text), $current_user); return '<p class="wppb-front-end-logout"><span>' . $text . '</span>' . $logout_link . '</p>'; }
function wppb_front_end_logout($atts) { if (!is_user_logged_in()) { return; } $current_user = get_userdata(get_current_user_id()); extract(shortcode_atts(array('text' => sprintf(__('You are currently logged in as %s. ', 'profile-builder'), $current_user->user_login), 'redirect' => wppb_curpageurl(), 'redirect_priority' => 'normal', 'link_text' => __('Log out »', 'profile-builder')), $atts)); if (PROFILE_BUILDER == 'Profile Builder Pro') { $wppb_module_settings = get_option('wppb_module_settings'); if (isset($wppb_module_settings['wppb_customRedirect']) && $wppb_module_settings['wppb_customRedirect'] == 'show' && $redirect_priority != 'top' && function_exists('wppb_custom_redirect_url')) { $redirect = wppb_custom_redirect_url('after_logout', $redirect); } } $redirect = apply_filters('wppb_after_logout_redirect_url', $redirect); $logout_link = '<a href="' . wp_logout_url($redirect) . '" class="wppb-logout-url" title="' . __('Log out of this account', 'profile-builder') . '">' . $link_text . '</a>'; $meta_tags = apply_filters('wppb_front_end_logout_meta_tags', array('{{meta_user_name}}', '{{meta_first_name}}', '{{meta_last_name}}', '{{meta_display_name}}')); $meta_tags_values = apply_filters('wppb_front_end_logout_meta_tags_values', array($current_user->user_login, $current_user->first_name, $current_user->last_name, $current_user->display_name)); $text = apply_filters('wppb_front_end_logout_text', str_replace($meta_tags, $meta_tags_values, $text), $current_user); return '<p class="wppb-front-end-logout"><span>' . $text . '</span>' . $logout_link . '</p>'; }
function wppb_front_end_register($atts) { ob_start(); global $current_user; global $wp_roles; global $wpdb; global $error; global $wppb_shortcode_on_front; //get required and shown fields $wppb_defaultOptions = get_option('wppb_default_settings'); //get "login with" setting $wppb_generalSettings = get_option('wppb_general_settings'); $wppb_shortcode_on_front = true; $agreed = true; $new_user = '******'; $multisite_message = false; $registerFilterArray = array(); $registerFilterArray2 = array(); $uploadExt = array(); $extraFieldsErrorHolder = array(); //we will use this array to store the ID's of the extra-fields left uncompleted get_currentuserinfo(); /* variables used to verify if all required fields were submitted*/ $firstnameComplete = 'yes'; $lastnameComplete = 'yes'; $nicknameComplete = 'yes'; $websiteComplete = 'yes'; $aimComplete = 'yes'; $yahooComplete = 'yes'; $jabberComplete = 'yes'; $bioComplete = 'yes'; /* END variables used to verify if all required fields were submitted*/ /* Check if users can register. */ $registration = get_option('users_can_register'); $registration = apply_filters('wppb_register_setting_override', $registration); //fallback if the file was largen then post_max_size, case in which no errors can be saved in $_FILES[fileName]['error'] if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') { $registerFilterArray['noPostError'] = '<p class="error">' . sprintf(__('The information size you were trying to submit was larger than %1$sb!<br/>This is usually caused by a large file(s) trying to be uploaded.<br/>Since it was also larger than %2$sb no additional information is available.<br/>The user was NOT created!', 'profilebuilder'), WPPB_SERVER_MAX_UPLOAD_SIZE_MEGA, WPPB_SERVER_MAX_POST_SIZE_MEGA) . '</p>'; echo $registerFilterArray['noPostError'] = apply_filters('wppb_register_no_post_error_message', $registerFilterArray['noPostError'], WPPB_SERVER_MAX_UPLOAD_SIZE_MEGA, WPPB_SERVER_MAX_POST_SIZE_MEGA); } /* 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') && $_POST['formName'] == 'register') { //global $wp_roles; //get value sent in the shortcode as parameter, use default if not set $default_role = get_option('default_role'); extract(shortcode_atts(array('role' => $default_role), $atts)); //check if the specified role exists in the database, else fall back to the "safe-zone" $aprovedRole = $role == $default_role || get_role($role) ? $role : $default_role; /* preset the values in case some are not submitted */ $user_pass = ''; if (isset($_POST['passw1'])) { $user_pass = esc_attr($_POST['passw1']); } $email = ''; if (isset($_POST['email'])) { $email = trim($_POST['email']); } if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { $user_name = wppb_generate_random_username($email); } else { $user_name = ''; if (isset($_POST['user_name'])) { $user_name = trim($_POST['user_name']); } } $first_name = ''; if (isset($_POST['first_name'])) { $first_name = trim($_POST['first_name']); } $last_name = ''; if (isset($_POST['last_name'])) { $last_name = trim($_POST['last_name']); } $nickname = ''; if (isset($_POST['nickname'])) { //the field is filled by the user upon registration $nickname = trim($_POST['nickname']); } elseif (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { //in case the nickname field is hidden, and the login with email is active $nickname = $email; } else { //in case the nickname field is hidden, but login is done with username $nickname = $user_name; } $website = ''; if (isset($_POST['website'])) { $website = trim($_POST['website']); } $aim = ''; if (isset($_POST['aim'])) { $aim = trim($_POST['aim']); } $yim = ''; if (isset($_POST['yim'])) { $yim = trim($_POST['yim']); } $jabber = ''; if (isset($_POST['jabber'])) { $jabber = trim($_POST['jabber']); } $description = ''; if (isset($_POST['description'])) { $description = trim($_POST['description']); } /* use filters to modify (if needed) the posted data before creating the user-data */ $user_pass = apply_filters('wppb_register_posted_password', $user_pass); $user_name = apply_filters('wppb_register_posted_username', $user_name); $first_name = apply_filters('wppb_register_posted_first_name', $first_name); $last_name = apply_filters('wppb_register_posted_last_name', $last_name); $nickname = apply_filters('wppb_register_posted_nickname', $nickname); $email = apply_filters('wppb_register_posted_email', $email); $website = apply_filters('wppb_register_posted_website', $website); $aim = apply_filters('wppb_register_posted_aim', $aim); $yim = apply_filters('wppb_register_posted_yahoo', $yim); $jabber = apply_filters('wppb_register_posted_jabber', $jabber); $description = apply_filters('wppb_register_posted_bio', $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($user_name), 'first_name' => esc_attr($first_name), 'last_name' => esc_attr($last_name), 'nickname' => esc_attr($nickname), 'user_email' => esc_attr($email), 'user_url' => esc_attr($website), 'aim' => esc_attr($aim), 'yim' => esc_attr($yim), 'jabber' => esc_attr($jabber), 'description' => esc_attr($description), 'role' => $aprovedRole); $userdata = apply_filters('wppb_register_userdata', $userdata); //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_type'] . $value['id']]) && $_POST[$value['item_type'] . $value['id']] == 'agree') { $agreed = true; } break; } // add filters for all the custom fields $_POST[$value['item_type'] . $value['id']] = apply_filters('wppb_register_' . $value['item_type'] . $value['id'] . '_general_filter', $_POST[$value['item_type'] . $value['id']]); } } $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'; } } if ($wppb_defaultOptions['lastname'] == 'show') { if ($wppb_defaultOptions['lastnameRequired'] == 'yes' && trim($_POST['last_name']) == '') { $lastnameComplete = 'no'; } } if ($wppb_defaultOptions['nickname'] == 'show') { if ($wppb_defaultOptions['nicknameRequired'] == 'yes' && trim($_POST['nickname']) == '') { $nicknameComplete = 'no'; } } if ($wppb_defaultOptions['website'] == 'show') { if ($wppb_defaultOptions['websiteRequired'] == 'yes' && trim($_POST['website']) == '') { $websiteComplete = 'no'; } } if ($wppb_defaultOptions['aim'] == 'show') { if ($wppb_defaultOptions['aimRequired'] == 'yes' && trim($_POST['aim']) == '') { $aimComplete = 'no'; } } if ($wppb_defaultOptions['yahoo'] == 'show') { if ($wppb_defaultOptions['yahooRequired'] == 'yes' && trim($_POST['yahoo']) == '') { $yahooComplete = 'no'; } } if ($wppb_defaultOptions['jabber'] == 'show') { if ($wppb_defaultOptions['jabberRequired'] == 'yes' && trim($_POST['jabber']) == '') { $jabberComplete = 'no'; } } if ($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_type'] . $value['id']] = apply_filters('wppb_register_input_custom_field_' . $value['id'], $_POST[$value['item_type'] . $value['id']]); if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); } } } break; case "checkbox": $checkboxOption = ''; $value['item_options'] = wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $id . '_options_translation', $value['item_options']); $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 (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($checkboxOption) == '') { array_push($extraFieldsErrorHolder, $value['id']); } } } break; case "radio": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); } } } break; case "select": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); } } } break; case "countrySelect": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); } } } break; case "timeZone": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); } } } break; case "datepicker": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); } } } break; case "textarea": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); } } } break; case "upload": $uploadedfile = $value['item_type'] . $value['id']; if (basename($_FILES[$uploadedfile]['name']) == '') { if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { array_push($extraFieldsErrorHolder, $value['id']); } } } elseif (basename($_FILES[$uploadedfile]['name']) != '') { //get allowed file types if ($value['item_options'] != NULL || $value['item_options'] != '') { $allFiles = false; $extensions = explode(',', $value['item_options']); foreach ($extensions as $key2 => $value2) { $extensions[$key2] = trim($value2); } } else { $allFiles = true; } $thisFileExtStart = strrpos($_FILES[$uploadedfile]['name'], '.'); $thisFileExt = substr($_FILES[$uploadedfile]['name'], $thisFileExtStart); if ($allFiles == false && !in_array($thisFileExt, $extensions)) { array_push($uploadExt, basename($_FILES[$uploadedfile]['name'])); $allowedExtensions = ''; (int) ($nrOfExt = count($extensions) - 2); foreach ($extensions as $key2 => $value2) { $allowedExtensions .= $value2; if ($key2 <= $nrOfExt) { $allowedExtensions .= ', '; } } } } 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 (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { array_push($extraFieldsErrorHolder, $value['id']); } } } } break; case "agreeToTerms": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if ($_POST[$value['item_type'] . $value['id']] == NULL) { 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']) { if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { } else { $error = apply_filters('wppb_register_userlogin_error1', __('A username is required for registration.', 'profilebuilder')); } } elseif (username_exists($userdata['user_login'])) { if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { } else { $error = apply_filters('wppb_register_userlogin_error2', __('Sorry, that username already exists!', 'profilebuilder')); } } elseif (!is_email($userdata['user_email'], true)) { $error = apply_filters('wppb_register_useremail_error1', __('You must enter a valid email address.', 'profilebuilder')); } elseif (email_exists($userdata['user_email'])) { $error = apply_filters('wppb_register_useremail_error2', __('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 = apply_filters('wppb_register_userpass_error1', __('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 = apply_filters('wppb_register_userpass_error2', __('The entered passwords don\'t match!', 'profilebuilder')); } } elseif (count($uploadExt) > 0) { $error = '<p class="semi-saved">' . __('There was an error while trying to upload the following attachment(s)', 'profilebuilder') . ': <span class="error">'; foreach ($uploadExt as $key5 => $name5) { $lastOne++; $error .= $name5; if (count($uploadExt) - $lastOne > 0) { $error .= ';<span style="padding-left:10px"></span>'; } } $error .= '</span><br/>' . __('Only files with the following extension(s) can be uploaded:', 'profilebuilder') . ' <span class="error">' . $allowedExtensions . '</span><br/><span class="error">' . __('The account was NOT created!', 'profilebuilder') . '</span> </p>'; } 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') . '<br/>' . __('(Several required fields were left uncompleted)', 'profilebuilder'); } else { $registered_name = $_POST['user_name']; //register the user normally if it is not a multi-site installation if (!is_multisite()) { $wppb_generalSettings = get_option('wppb_general_settings'); if ($wppb_generalSettings['emailConfirmation'] == 'yes') { $foundError = false; if (is_multisite()) { $userSignup = $wpdb->get_results("SELECT * FROM {$wpdb->signups} WHERE user_login='******'user_login'] . "' OR user_email='" . $userdata['user_email'] . "'"); } else { $userSignup = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "signups WHERE user_login='******'user_login'] . "' OR user_email='" . $userdata['user_email'] . "'"); } if (trim($userSignup[0]->user_login) == $userdata['user_login']) { $foundError = true; $error = __('This username is already reserved to be used soon.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder'); } elseif (trim($userSignup[0]->user_email) == $userdata['user_email']) { $foundError = true; $error = __('This email address is already reserved to be used soon.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder'); } if ($foundError) { } else { $new_user = '******'; $multisite_message = true; $meta = array('user_pass' => base64_encode($userdata['user_pass']), 'first_name' => $userdata['first_name'], 'last_name' => $userdata['last_name'], 'nickname' => $userdata['nickname'], 'user_url' => $userdata['user_url'], 'aim' => $userdata['aim'], 'yim' => $userdata['yim'], 'jabber' => $userdata['jabber'], 'description' => $userdata['description'], 'role' => $userdata['role']); $meta = wppb_add_custom_field_values($_POST, $meta); wppb_signup_user($userdata['user_login'], $userdata['user_email'], $meta); } } else { $new_user = wp_insert_user($userdata); /* add the extra profile information */ $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": add_user_meta($new_user, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); break; case "hiddenInput": add_user_meta($new_user, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); break; case "checkbox": $checkboxOption = ''; $value['item_options'] = wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $id . '_options_translation', $value['item_options']); $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 . ','; } } add_user_meta($new_user, $value['item_metaName'], $checkboxOption); break; case "radio": add_user_meta($new_user, $value['item_metaName'], $_POST[$value['item_type'] . $value['id']]); break; case "select": add_user_meta($new_user, $value['item_metaName'], $_POST[$value['item_type'] . $value['id']]); break; case "countrySelect": update_user_meta($new_user, $value['item_metaName'], $_POST[$value['item_type'] . $value['id']]); break; case "timeZone": update_user_meta($new_user, $value['item_metaName'], $_POST[$value['item_type'] . $value['id']]); break; case "datepicker": update_user_meta($new_user, $value['item_metaName'], $_POST[$value['item_type'] . $value['id']]); break; case "textarea": add_user_meta($new_user, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); break; case "upload": $uploadedfile = $value['item_type'] . $value['id']; //first we need to verify if we don't try to upload a 0b or 0 length file if (basename($_FILES[$uploadedfile]['name']) != '') { //second we need to verify if the uploaded file size is less then the set file size in php.ini if ($_FILES[$uploadedfile]['size'] < WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE && $_FILES[$uploadedfile]['size'] != 0) { //we need to prepare the basename of the file, so that ' becomes ` as ' gives an error $fileName = basename($_FILES[$uploadedfile]['name']); $finalFileName = ''; for ($i = 0; $i < strlen($fileName); $i++) { if ($fileName[$i] == "'") { $finalFileName .= '`'; } else { $finalFileName .= $fileName[$i]; } } //create the target path for uploading $wpUploadPath = wp_upload_dir(); // Array of key => value pairs $target_path = $wpUploadPath['basedir'] . "/profile_builder/attachments/"; $target_path = $target_path . 'userID_' . $new_user . '_attachment_' . $finalFileName; if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)) { //$upFile = get_bloginfo('home').'/'.$target_path; $upFile = $wpUploadPath['baseurl'] . '/profile_builder/attachments/userID_' . $new_user . '_attachment_' . $finalFileName; add_user_meta($new_user, $value['item_metaName'], $upFile); $pictureUpload = 'yes'; } } } break; case "avatar": $uploadedfile = $value['item_type'] . $value['id']; $wpUploadPath = wp_upload_dir(); // Array of key => value pairs $target_path_original = $wpUploadPath['basedir'] . "/profile_builder/avatars/"; $fileName = $_FILES[$uploadedfile]['name']; $finalFileName = ''; for ($i = 0; $i < strlen($fileName); $i++) { if ($fileName[$i] == "'") { $finalFileName .= '`'; } elseif ($fileName[$i] == ' ') { $finalFileName .= '_'; } else { $finalFileName .= $fileName[$i]; } } $fileName = $finalFileName; $target_path = $target_path_original . 'userID_' . $new_user . '_originalAvatar_' . $fileName; /* when trying to upload file, be sure it's one of the accepted image file-types */ 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') && ($_FILES[$uploadedfile]['size'] < WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE && $_FILES[$uploadedfile]['size'] != 0)) { $wp_filetype = wp_check_filetype(basename($_FILES[$uploadedfile]['name']), null); $attachment = array('post_mime_type' => $wp_filetype['type'], 'post_title' => $fileName, 'post_content' => '', 'post_status' => 'inherit'); $attach_id = wp_insert_attachment($attachment, $target_path); $upFile = image_downsize($attach_id, 'thumbnail'); $upFile = $upFile[0]; //if file upload succeded if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)) { add_user_meta($new_user, $value['item_metaName'], $upFile); wppb_resize_avatar($new_user); $avatarUpload = 'yes'; } else { $avatarUpload = 'no'; } } if ($_FILES[$uploadedfile]['type'] == '') { $avatarUpload = 'yes'; } break; } } } // if admin approval is activated, then block the user untill he gets approved $wppb_generalSettings = get_option('wppb_general_settings', 'not_found'); if ($wppb_generalSettings != 'not_found') { if ($wppb_generalSettings['adminApproval'] == 'yes') { wp_set_object_terms($new_user, array('unapproved'), 'user_status', false); clean_object_term_cache($new_user, 'user_status'); } } // send an email to the admin, and - if selected - to the user also. $bloginfo = get_bloginfo('name'); $sentEmailStatus = wppb_notify_user_registration_email($bloginfo, esc_attr($_POST['user_name']), esc_attr($_POST['email']), $_POST['send_credentials_via_email'], $_POST['passw1'], $wppb_generalSettings['adminApproval']); } } elseif (is_multisite()) { //validate username and email $validationRes = wpmu_validate_user_signup($userdata['user_login'], $userdata['user_email']); $error = apply_filters('wppb_register_wpmu_registration_error', $validationRes['errors']->get_error_message()); if (trim($error) != '') { } else { $new_user = '******'; $multisite_message = true; $meta = array('user_pass' => base64_encode($userdata['user_pass']), 'first_name' => $userdata['first_name'], 'last_name' => $userdata['last_name'], 'nickname' => $userdata['nickname'], 'user_url' => $userdata['user_url'], 'aim' => $userdata['aim'], 'yim' => $userdata['yim'], 'jabber' => $userdata['jabber'], 'description' => $userdata['description'], 'role' => $userdata['role']); $meta = wppb_add_custom_field_values($_POST, $meta); wppb_signup_user($userdata['user_login'], $userdata['user_email'], $meta); } } } } ?> <div class="wppb_holder" id="wppb_register"> <?php if (is_user_logged_in() && !current_user_can('create_users')) { global $user_ID; $login = get_userdata($user_ID); if ($login->display_name == '') { $login->display_name = $login->user_login; } $registerFilterArray['loginLogoutError'] = ' <p class="log-in-out alert">' . __('You are logged in as', 'profilebuilder') . ' <a href="' . get_author_posts_url($login->ID) . '" title="' . $login->display_name . '">' . $login->display_name . '</a>. ' . __('You don\'t need another account.', 'profilebuilder') . ' <a href="' . wp_logout_url(get_permalink()) . '" title="' . __('Log out of this account.', 'profilebuilder') . '">' . __('Logout', 'profilebuilder') . ' »</a></p><!-- .log-in-out .alert -->'; $registerFilterArray['loginLogoutError'] = apply_filters('wppb_register_have_account_alert', $registerFilterArray['loginLogoutError'], $login->ID); echo $registerFilterArray['loginLogoutError']; } elseif ($new_user != 'no') { if (current_user_can('create_users')) { if ($multisite_message) { $registerFilterArray['wpmuRegistrationMessage1'] = '<p class="success">' . sprintf(__('An email has been sent to %1$s with information on how to activate his/her account.', 'profilebuilder'), $userdata['user_email']) . '</p><!-- .success -->'; echo $registerFilterArray['registrationMessage1'] = apply_filters('wppb_wpmu_register_account_created1', $registerFilterArray['wpmuRegistrationMessage1'], $registered_name, $userdata['user_email']); } else { $registerFilterArray['registrationMessage1'] = '<p class="success">' . sprintf(__('A user account has been created for %1$s.', 'profilebuilder'), $registered_name) . '</p><!-- .success -->'; echo $registerFilterArray['registrationMessage1'] = apply_filters('wppb_register_account_created1', $registerFilterArray['registrationMessage1'], $registered_name); } $redirectLink = wppb_curpageurl(); if (file_exists(WPPB_PLUGIN_DIR . '/premium/addons/addon.php')) { //check to see if the redirecting addon is present and activated $wppb_addon_settings = get_option('wppb_addon_settings'); if ($wppb_addon_settings['wppb_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']); if (wppb_check_missing_http($redirectLink)) { $redirectLink = 'http://' . $redirectLink; } } } } $registerFilterArray['redirectMessage1'] = '<font id="messageTextColor">' . sprintf(__('You will soon be redirected automatically. If you see this page for more than 3 seconds, please click %1$s.%2$s', 'profilebuilder'), '<a href="' . $redirectLink . '">' . __('here', 'profilebuilder') . '</a>', '<meta http-equiv="Refresh" content="3;url=' . $redirectLink . '" />') . '</font><br/><br/>'; echo $registerFilterArray['redirectMessage1'] = apply_filters('wppb_register_redirect_after_creation1', $registerFilterArray['redirectMessage1'], $redirectLink); } else { if ($multisite_message) { $registerFilterArray['wpmuRegistrationMessage2'] = '<p class="success">' . __('An email has been sent to you with information on how to activate your account.', 'profilebuilder') . '</p><!-- .success -->'; echo $registerFilterArray['wpmuRegistrationMessage2'] = apply_filters('wppb_register_account_created2', $registerFilterArray['wpmuRegistrationMessage2'], $registered_name); } else { $registerFilterArray['registrationMessage2'] = '<p class="success">' . sprintf(__('Thank you for registering %1$s.', 'profilebuilder'), $registered_name) . '</p><!-- .success -->'; echo $registerFilterArray['registrationMessage2'] = apply_filters('wppb_register_account_created2', $registerFilterArray['registrationMessage2'], $registered_name); } $redirectLink = wppb_curpageurl(); if (file_exists(WPPB_PLUGIN_DIR . '/premium/addons/addon.php')) { //check to see if the redirecting addon is present and activated $wppb_addon_settings = get_option('wppb_addon_settings'); if ($wppb_addon_settings['wppb_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']); if (wppb_check_missing_http($redirectLink)) { $redirectLink = 'http://' . $redirectLink; } } } } $registerFilterArray['redirectMessage2'] = '<font id="messageTextColor">' . sprintf(__('You will soon be redirected automatically. If you see this page for more than 3 seconds, please click %1$s.%2$s', 'profilebuilder'), '<a href="' . $redirectLink . '">' . __('here', 'profilebuilder') . '</a>', '<meta http-equiv="Refresh" content="3;url=' . $redirectLink . '" />') . '</font><br/><br/>'; echo $registerFilterArray['redirectMessage2'] = apply_filters('wppb_register_redirect_after_creation2', $registerFilterArray['redirectMessage2'], $redirectLink); } if (isset($_POST['send_credentials_via_email'])) { if ($sentEmailStatus == 1) { $registerFilterArray['emailMessage1'] = '<p class="error">' . __('An error occured while trying to send the notification email.', 'profilebuilder') . '</p><!-- .error -->'; $registerFilterArray['emailMessage1'] = apply_filters('wppb_register_send_notification_email_fail', $registerFilterArray['emailMessage1']); echo $registerFilterArray['emailMessage1']; } elseif ($sentEmailStatus == 2) { if ($multisite_message) { $registerFilterArray['wpmuEmailMessage2'] = '<p class="success">' . __('An email containing activation instructions was successfully sent.', 'profilebuilder') . '</p><!-- .success -->'; $registerFilterArray['wpmuEmailMessage2'] = apply_filters('wppb_register_send_notification_email_success', $registerFilterArray['wpmuEmailMessage2']); echo $registerFilterArray['wpmuEmailMessage2']; } else { $registerFilterArray['emailMessage2'] = '<p class="success">' . __('An email containing the username and password was successfully sent.', 'profilebuilder') . '</p><!-- .success -->'; $registerFilterArray['emailMessage2'] = apply_filters('wppb_register_send_notification_email_success', $registerFilterArray['emailMessage2']); echo $registerFilterArray['emailMessage2']; } } } } else { if ($error) { $registerFilterArray['errorMessage'] = '<p class="error">' . $error . '</p><!-- .error -->'; $registerFilterArray['errorMessage'] = apply_filters('wppb_register_error_messaging', $registerFilterArray['errorMessage'], $error); echo $registerFilterArray['errorMessage']; } if (current_user_can('create_users') && $registration) { $registerFilterArray['alertMessage1'] = '<p class="alert">' . __('Users can register themselves or you can manually create users here.', 'profilebuilder') . '</p><!-- .alert -->'; $registerFilterArray['alertMessage1'] = apply_filters('wppb_register_alert_messaging1', $registerFilterArray['alertMessage1']); echo $registerFilterArray['alertMessage1']; } elseif (current_user_can('create_users')) { $registerFilterArray['alertMessage2'] = '<p class="alert">' . __('Users cannot currently register themselves, but you can manually create users here.', 'profilebuilder') . '</p><!-- .alert -->'; $registerFilterArray['alertMessage2'] = apply_filters('wppb_register_alert_messaging2', $registerFilterArray['alertMessage2']); echo $registerFilterArray['alertMessage2']; } elseif (!current_user_can('create_users') && !$registration) { $registerFilterArray['alertMessage3'] = '<p class="alert">' . __('Only an administrator can add new users.', 'profilebuilder') . '</p><!-- .alert -->'; $registerFilterArray['alertMessage3'] = apply_filters('wppb_register_alert_messaging3', $registerFilterArray['alertMessage3']); echo $registerFilterArray['alertMessage3']; } 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'); ?> <form enctype="multipart/form-data" method="post" id="adduser" class="user-forms" action="http://<?php echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?> "> <?php echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE . '" /><!-- set the MAX_FILE_SIZE to the server\'s current max upload size in bytes -->'; $registerFilterArray2['name1'] = '<p class="registerNameHeading"><strong>' . __('Name', 'profilebuilder') . '</strong></p>'; $registerFilterArray2['name1'] = apply_filters('wppb_register_content_name1', $registerFilterArray2['name1']); if ($wppb_defaultOptions['username'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['usernameRequired'] == 'yes') { $errorMark = '<font color="red" title="This field is required for registration.">*</font>'; if (isset($_POST['user_name'])) { if (trim($_POST['user_name']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field must be filled out before registering (It was marked as required by the administrator)', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { if ($wppb_defaultOptions['email'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['emailRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['email'])) { if (trim($_POST['email']) == '' || !is_email(trim($_POST['email']))) { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="This field is required for registration."/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['email'])) { $localVar = $_POST['email']; } $registerFilterArray2['name2'] = ' <p class="form-email' . $errorVar . '"> <label for="email">' . __('E-mail', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="email" type="text" id="email" value="' . trim($localVar) . '" /> </p><!-- .form-email -->'; $registerFilterArray2['name2'] = apply_filters('wppb_register_content_name2_with_email', $registerFilterArray2['name2'], trim($localVar), $errorVar, $errorMark); } } else { $localVar = ''; if (isset($_POST['user_name'])) { $localVar = $_POST['user_name']; } $registerFilterArray2['name2'] = ' <p class="form-username' . $errorVar . '"> <label for="user_name">' . __('Username', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="user_name" type="text" id="user_name" value="' . trim($localVar) . '" /> </p><!-- .form-username -->'; $registerFilterArray2['name2'] = apply_filters('wppb_register_content_name2', $registerFilterArray2['name2'], trim($localVar), $errorVar, $errorMark); } } if ($wppb_defaultOptions['firstname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['firstnameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['first_name'])) { if (trim($_POST['first_name']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field must be filled out before registering (It was marked as required by the administrator)', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['first_name'])) { $localVar = $_POST['first_name']; } $registerFilterArray2['name3'] = ' <p class="first_name' . $errorVar . '"> <label for="first_name">' . __('First Name', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="first_name" type="text" id="first_name" value="' . trim($localVar) . '" /> </p><!-- .first_name -->'; $registerFilterArray2['name3'] = apply_filters('wppb_register_content_name3', $registerFilterArray2['name3'], trim($localVar), $errorVar, $errorMark); } if ($wppb_defaultOptions['lastname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['lastnameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['last_name'])) { if (trim($_POST['last_name']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field must be filled out before registering (It was marked as required by the administrator)', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['last_name'])) { $localVar = $_POST['last_name']; } $registerFilterArray2['name4'] = ' <p class="last_name' . $errorVar . '"> <label for="last_name">' . __('Last Name', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="last_name" type="text" id="last_name" value="' . trim($localVar) . '" /> </p><!-- .last_name -->'; $registerFilterArray2['name4'] = apply_filters('wppb_register_content_name4', $registerFilterArray2['name4'], trim($localVar), $errorVar, $errorMark); } if ($wppb_defaultOptions['nickname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['nicknameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['nickname'])) { if (trim($_POST['nickname']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field must be filled out before registering (It was marked as required by the administrator)', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['nickname'])) { $localVar = $_POST['nickname']; } $registerFilterArray2['name5'] = ' <p class="nickname' . $errorVar . '"> <label for="nickname">' . __('Nickname', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="nickname" type="text" id="nickname" value="' . trim($localVar) . '" /> </p><!-- .nickname -->'; $registerFilterArray2['name5'] = apply_filters('wppb_register_content_name5', $registerFilterArray2['name5'], trim($localVar), $errorVar, $errorMark); } $registerFilterArray2['info1'] = '<p class="registerContactInfoHeading"><strong>' . __('Contact Info', 'profilebuilder') . '</strong></p>'; $registerFilterArray2['info1'] = apply_filters('wppb_register_content_info1', $registerFilterArray2['info1']); if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { } else { if ($wppb_defaultOptions['email'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['emailRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['email'])) { if (trim($_POST['email']) == '' || !is_email(trim($_POST['email']))) { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="This field is required for registration."/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['email'])) { $localVar = $_POST['email']; } $registerFilterArray2['info2'] = ' <p class="form-email' . $errorVar . '"> <label for="email">' . __('E-mail', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="email" type="text" id="email" value="' . trim($localVar) . '" /> </p><!-- .form-email -->'; $registerFilterArray2['info2'] = apply_filters('wppb_register_content_info2', $registerFilterArray2['info2'], trim($localVar), $errorVar, $errorMark); } } if ($wppb_defaultOptions['website'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['websiteRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['website'])) { if (trim($_POST['website']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field must be filled out before registering (It was marked as required by the administrator)', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['website'])) { $localVar = $_POST['website']; } $registerFilterArray2['info3'] = ' <p class="form-website' . $errorVar . '"> <label for="website">' . __('Website', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="website" type="text" id="website" value="' . trim($localVar) . '" /> </p><!-- .form-website -->'; $registerFilterArray2['info3'] = apply_filters('wppb_register_content_info3', $registerFilterArray2['info3'], trim($localVar), $errorVar, $errorMark); } if ($wppb_defaultOptions['aim'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['aimRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['aim'])) { if (trim($_POST['aim']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field must be filled out before registering (It was marked as required by the administrator)', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['aim'])) { $localVar = $_POST['aim']; } $registerFilterArray2['info4'] = ' <p class="form-aim' . $errorVar . '"> <label for="aim">' . __('AIM', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="aim" type="text" id="aim" value="' . trim($localVar) . '" /> </p><!-- .form-aim -->'; $registerFilterArray2['info4'] = apply_filters('wppb_register_content_info4', $registerFilterArray2['info4'], trim($localVar), $errorVar, $errorMark); } if ($wppb_defaultOptions['yahoo'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['yahooRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['yim'])) { if (trim($_POST['yim']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field must be filled out before registering (It was marked as required by the administrator)', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['yim'])) { $localVar = $_POST['yim']; } $registerFilterArray2['info5'] = ' <p class="form-yim' . $errorVar . '"> <label for="yim">' . __('Yahoo IM', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="yim" type="text" id="yim" value="' . trim($localVar) . '" /> </p><!-- .form-yim -->'; $registerFilterArray2['info5'] = apply_filters('wppb_register_content_info5', $registerFilterArray2['info5'], trim($localVar), $errorVar, $errorMark); } if ($wppb_defaultOptions['jabber'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['jabberRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['jabber'])) { if (trim($_POST['jabber']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field must be filled out before registering (It was marked as required by the administrator)', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['jabber'])) { $localVar = $_POST['jabber']; } $registerFilterArray2['info6'] = ' <p class="form-jabber' . $errorVar . '"> <label for="jabber">' . __('Jabber / Google Talk', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="jabber" type="text" id="jabber" value="' . trim($localVar) . '" /> </p><!-- .form-jabber -->'; $registerFilterArray2['info6'] = apply_filters('wppb_register_content_info6', $registerFilterArray2['info6'], trim($localVar), $errorVar, $errorMark); } $registerFilterArray2['ay1'] = '<p class="registerAboutYourselfHeader"><strong>' . __('About Yourself', 'profilebuilder') . '</strong></p>'; $registerFilterArray2['ay1'] = apply_filters('wppb_register_content_about_yourself1', $registerFilterArray2['ay1']); if ($wppb_defaultOptions['bio'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['bioRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator', 'profilebuilder') . '">*</font>'; if (isset($_POST['description'])) { if (trim($_POST['description']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field must be filled out before registering (It was marked as required by the administrator)', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $localVar = ''; if (isset($_POST['description'])) { $localVar = $_POST['description']; } $registerFilterArray2['ay2'] = ' <p class="form-description' . $errorVar . '"> <label for="description">' . __('Biographical Info', 'profilebuilder') . $errorMark . '</label> <textarea class="text-input" name="description" id="description" rows="5" cols="30">' . trim($localVar) . '</textarea> </p><!-- .form-description -->'; $registerFilterArray2['ay2'] = apply_filters('wppb_register_content_about_yourself2', $registerFilterArray2['ay2'], trim($localVar), $errorVar, $errorMark); } if ($wppb_defaultOptions['password'] == 'show') { $errorMark = ''; $errorMark2 = ''; $errorVar = ''; $errorVar2 = ''; if ($wppb_defaultOptions['passwordRequired'] == 'yes') { $errorMark = '<font color="red" title="This field is required for registration.">*</font>'; $errorMark2 = '<font color="red" title="This field is required for registration.">*</font>'; if (isset($_POST['passw1'])) { if (trim($_POST['passw1']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="This field is required for registration."/>'; $errorVar = ' errorHolder'; } } if (isset($_POST['passw2'])) { if (trim($_POST['passw2']) == '') { $errorMark2 = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="This field is required for registration."/>'; $errorVar2 = ' errorHolder'; } } } $localVar1 = ''; if (isset($_POST['passw1'])) { $localVar1 = $_POST['passw1']; } $localVar2 = ''; if (isset($_POST['passw2'])) { $localVar2 = $_POST['passw2']; } $registerFilterArray2['ay3'] = ' <p class="form-password' . $errorVar . '"> <label for="pass1">' . __('Password', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="passw1" type="password" id="pass1" value="' . trim($localVar1) . '" /> </p><!-- .form-password --> <p class="form-password' . $errorVar2 . '"> <label for="pass2">' . __('Repeat Password', 'profilebuilder') . $errorMark2 . '</label> <input class="text-input" name="passw2" type="password" id="pass2" value="' . trim($localVar2) . '" /> </p><!-- .form-password -->'; $registerFilterArray2['ay3'] = apply_filters('wppb_register_content_about_yourself3', $registerFilterArray2['ay3'], trim($localVar1), trim($localVar2), $errorVar, $errorMark, $errorVar2, $errorMark2); } $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/'; if (file_exists($wppb_premium . 'extra.fields.php')) { require_once $wppb_premium . 'extra.fields.php'; //register_user_extra_fields($error, $_POST, $extraFieldsErrorHolder); $page = 'register'; $returnedValue = wppb_extra_fields($current_user->id, $extraFieldsErrorHolder, $registerFilterArray, $page, $error, $_POST); //copy over extra fields to the rest of the fieldso on the edit profile foreach ($returnedValue as $key => $value) { $registerFilterArray2[$key] = apply_filters('wppb_register_content_' . $key, $value); } } if (function_exists('wppb_add_recaptcha_to_registration_form')) { $wppb_addon_settings = get_option('wppb_addon_settings'); if ($wppb_addon_settings['wppb_reCaptcha'] == 'show') { $reCAPTCHAForm = wppb_add_recaptcha_to_registration_form(); $labelName = apply_filters('wppb_register_anti_spam_title', __('Anti-Spam', 'profilebuilder')); $registerFilterArray2['reCAPTCHAForm'] = '<div class="form-reCAPTCHA"><label class="form-reCAPTCHA-label" for="' . $labelName . '">' . $labelName . '</label>' . $reCAPTCHAForm . '</div><!-- .form-reCAPTCHA -->'; } } // additional filter, just in case it is needed $registerFilterArray2['extraRegistrationFilter'] = ''; $registerFilterArray2['extraRegistrationFilter'] = apply_filters('extraRegistrationField', $registerFilterArray2['extraRegistrationFilter']); // END additional filter, just in case it is needed $wppb_generalSettings = get_option('wppb_general_settings'); if ($wppb_generalSettings['emailConfirmation'] != 'yes') { if (!is_multisite()) { if (isset($_POST['send_credentials_via_email'])) { $checkedVar = ' checked'; } else { $checkedVar = ''; } $registerFilterArray2['confirmationEmailForm'] = ' <p class="send-confirmation-email"> <label for="send-confirmation-email"> <input id="send_credentials_via_email" type="checkbox" name="send_credentials_via_email" value="sending"' . $checkedVar . '/> ' . __('Send these credentials via email.', 'profilebuilder') . ' </label> </p><!-- .send-confirmation-email -->'; $registerFilterArray2['confirmationEmailForm'] = apply_filters('wppb_register_confirmation_email_form', $registerFilterArray2['confirmationEmailForm'], $checkedVar); } } $registerFilterArray2 = apply_filters('wppb_register', $registerFilterArray2); foreach ($registerFilterArray2 as $key => $value) { echo $value; } ?> <p class="form-submit"> <input name="adduser" type="submit" id="addusersub" class="submit button" value="<?php if (current_user_can('create_users')) { _e('Add User', 'profilebuilder'); } else { _e('Register', 'profilebuilder'); } ?> " /> <input name="action" type="hidden" id="action" value="adduser" /> <input type="hidden" name="formName" value="register" /> </p><!-- .form-submit --> <?php wp_nonce_field('verify_true_registration', 'register_nonce_field'); ?> </form><!-- #adduser --> <?php } } /* use this action hook to add extra content after the register form. */ do_action('wppb_after_register_fields'); ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }
function wppb_get_redirect() { if ($this->args['login_after_register'] == 'Yes') { return $this->wppb_log_in_user(); } if ($this->args['redirect_activated'] == 'No' || $this->args['form_type'] == 'edit_profile' && $this->args['form_name'] == 'unspecified' && wppb_curpageurl() == $this->args['redirect_url'] || $this->args['form_type'] == 'register' && $this->args['form_name'] == 'unspecified' && wppb_curpageurl() == $this->args['redirect_url']) { return ''; } /* if we don't have a preference on the form for redirect then if we have a custom redirect "after register redirect" option redirect to that if not don't do anything */ if ($this->args['redirect_activated'] == '-') { if (!empty($this->args['custom_redirect_after_register_url'])) { $this->args['redirect_url'] = $this->args['custom_redirect_after_register_url']; } else { return ''; } } $redirect_location = wppb_check_missing_http($this->args['redirect_url']) ? 'http://' . $this->args['redirect_url'] : $this->args['redirect_url']; $redirect_url = apply_filters('wppb_redirect_url', '<a href="' . $redirect_location . '">' . __('here', 'profile-builder') . '</a>'); return apply_filters('wppb_redirect_message_before_returning', '<p class="redirect_message">' . sprintf(__('You will soon be redirected automatically. If you see this page for more than %1$d seconds, please click %2$s.%3$s', 'profile-builder'), $this->args['redirect_delay'], $redirect_url, '<meta http-equiv="Refresh" content="' . $this->args['redirect_delay'] . ';url=' . $redirect_location . '" />') . '</p>', $this->args); }
/** * The function for the recover password shortcode * */ function wppb_front_end_password_recovery() { global $wppb_shortcode_on_front; $wppb_shortcode_on_front = true; $message = $messageNo = $message2 = $messageNo2 = $linkLoginName = $linkKey = ''; global $wpdb; ob_start(); //Get general settings $wppb_generalSettings = get_option('wppb_general_settings'); // If the user entered an email/username, process the request if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'recover_password' && wp_verify_nonce($_POST['password_recovery_nonce_field'], 'verify_true_password_recovery')) { $postedData = $_POST['username_email']; //we get the raw data //check to see if it's an e-mail (and if this is valid/present in the database) or is a username // if we do not have an email in the posted date we try to get the email for that user if (!is_email($postedData)) { if (username_exists($postedData)) { $query = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_login= %s", $postedData)); if (!empty($query[0])) { $postedData = $query[0]->user_email; } } else { $message = __('The username entered wasn\'t found in the database!', 'profile-builder') . '<br/>' . __('Please check that you entered the correct username.', 'profile-builder'); $message = apply_filters('wppb_recover_password_sent_message4', $message); $messageNo = '4'; } } // we should have an email by this point if (is_email($postedData)) { if (email_exists($postedData)) { $retVal = wppb_check_for_unapproved_user($postedData, 'user_email'); if ($retVal[0] != '') { $message = $retVal[0]; $messageNo = $retVal[1]; } else { $message = sprintf(__('Check your e-mail for the confirmation link.', 'profile-builder'), $postedData); $message = apply_filters('wppb_recover_password_sent_message1', $message, $postedData); $messageNo = '1'; } } elseif (!email_exists($postedData)) { $message = __('The email address entered wasn\'t found in the database!', 'profile-builder') . '<br/>' . __('Please check that you entered the correct email address.', 'profile-builder'); $message = apply_filters('wppb_recover_password_sent_message2', $message); $messageNo = '2'; } } // For some extra validations you can filter messageNo $messageNo = apply_filters('wppb_recover_password_message_no', $messageNo); if ($messageNo == '1') { //verify e-mail validity $query = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_email= %s", $postedData)); if (!empty($query[0])) { $requestedUserID = $query[0]->ID; $requestedUserLogin = $query[0]->user_login; $requestedUserEmail = $query[0]->user_email; $requestedUserNicename = $query[0]->user_nicename; if ($wppb_generalSettings['loginWith'] == 'username') { $display_username_email = $query[0]->user_login; } else { $display_username_email = $query[0]->user_email; } //search if there is already an activation key present, if not create one $key = wppb_retrieve_activation_key($requestedUserLogin); //send primary email message $recoveruserMailMessage1 = sprintf(__('Someone requested that the password be reset for the following account: <b>%1$s</b><br/>If this was a mistake, just ignore this email and nothing will happen.<br/>To reset your password, visit the following link:%2$s', 'profile-builder'), $display_username_email, '<a href="' . esc_url(add_query_arg(array('loginName' => $requestedUserNicename, 'key' => $key), wppb_curpageurl())) . '">' . esc_url(add_query_arg(array('loginName' => $requestedUserNicename, 'key' => $key), wppb_curpageurl())) . '</a>'); $recoveruserMailMessage1 = apply_filters('wppb_recover_password_message_content_sent_to_user1', $recoveruserMailMessage1, $requestedUserID, $requestedUserLogin, $requestedUserEmail); $recoveruserMailMessageTitle1 = sprintf(__('Password Reset from "%1$s"', 'profile-builder'), $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES)); $recoveruserMailMessageTitle1 = apply_filters('wppb_recover_password_message_title_sent_to_user1', $recoveruserMailMessageTitle1, $requestedUserLogin); //we add this filter to enable html encoding add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); //send mail to the user notifying him of the reset request if (trim($recoveruserMailMessageTitle1) != '') { $sent = wp_mail($requestedUserEmail, $recoveruserMailMessageTitle1, $recoveruserMailMessage1); if ($sent === false) { $message = '<b>' . __('ERROR', 'profile-builder') . ': </b>' . sprintf(__('There was an error while trying to send the activation link to %1$s!', 'profile-builder'), $postedData); $message = apply_filters('wppb_recover_password_sent_message_error_sending', $message); $messageNo = '5'; } } } } } elseif ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action2']) && $_POST['action2'] == 'recover_password2' && wp_verify_nonce($_POST['password_recovery_nonce_field2'], 'verify_true_password_recovery2_' . $_POST['userData'])) { if ($_POST['passw1'] == $_POST['passw2'] && (!empty($_POST['passw1']) && !empty($_POST['passw2']))) { if (!empty($wppb_generalSettings['minimum_password_length']) || isset($_POST['wppb_password_strength']) && !empty($wppb_generalSettings['minimum_password_strength'])) { $message2 = ''; if (wppb_check_password_length($_POST['passw1'])) { $message2 .= '<br/>' . sprintf(__("The password must have the minimum length of %s characters", "profile-builder"), $wppb_generalSettings['minimum_password_length']) . '<br/>'; $messageNo2 = '2'; } if (wppb_check_password_strength()) { $message2 .= '<br/>' . sprintf(__("The password must have a minimum strength of %s", "profile-builder"), wppb_check_password_strength()); $messageNo2 = '2'; } } if ($messageNo2 != 2) { $message2 = __('Your password has been successfully changed!', 'profile-builder'); $messageNo2 = '1'; $userID = $_POST['userData']; $new_pass = $_POST['passw1']; //update the new password and delete the key do_action('wppb_password_reset', $userID, $new_pass); wp_set_password($new_pass, $userID); $user_info = get_userdata($userID); if ($wppb_generalSettings['loginWith'] == 'username') { $display_username_email = $user_info->user_login; } else { $display_username_email = $user_info->user_email; } //send secondary mail to the user containing the username and the new password $recoveruserMailMessage2 = sprintf(__('You have successfully reset your password to: %1$s', 'profile-builder'), $new_pass); $recoveruserMailMessage2 = apply_filters('wppb_recover_password_message_content_sent_to_user2', $recoveruserMailMessage2, $display_username_email, $new_pass, $userID); $recoveruserMailMessageTitle2 = sprintf(__('Password Successfully Reset for %1$s on "%2$s"', 'profile-builder'), $display_username_email, $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES)); $recoveruserMailMessageTitle2 = apply_filters('wppb_recover_password_message_title_sent_to_user2', $recoveruserMailMessageTitle2, $display_username_email); //we add this filter to enable html encoding add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); //send mail to the user notifying him of the reset request if (trim($recoveruserMailMessageTitle2) != '') { wp_mail($user_info->user_email, $recoveruserMailMessageTitle2, $recoveruserMailMessage2); } //send email to admin $recoveradminMailMessage = sprintf(__('%1$s has requested a password change via the password reset feature.<br/>His/her new password is:%2$s', 'profile-builder'), $display_username_email, $_POST['passw1']); $recoveradminMailMessage = apply_filters('wppb_recover_password_message_content_sent_to_admin', $recoveradminMailMessage, $display_username_email, $_POST['passw1'], $userID); $recoveradminMailMessageTitle = sprintf(__('Password Successfully Reset for %1$s on "%2$s"', 'profile-builder'), $display_username_email, $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES)); $recoveradminMailMessageTitle = apply_filters('wppb_recover_password_message_title_sent_to_admin', $recoveradminMailMessageTitle, $display_username_email); //we disable the feature to send the admin a notification mail but can be still used using filters $recoveradminMailMessageTitle = ''; $recoveradminMailMessageTitle = apply_filters('wppb_recover_password_message_title_sent_to_admin', $recoveradminMailMessageTitle, $display_username_email); //we add this filter to enable html encoding add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); //send mail to the admin notifying him of of a user with a password reset request if (trim($recoveradminMailMessageTitle) != '') { wp_mail(get_option('admin_email'), $recoveradminMailMessageTitle, $recoveradminMailMessage); } } } else { $message2 = __('The entered passwords don\'t match!', 'profile-builder'); $messageNo2 = '2'; } } ?> <div class="wppb_holder" id="wppb-recover-password"> <?php // use this action hook to add extra content before the password recovery form do_action('wppb_before_recover_password_fields'); //this is the part that handles the actual recovery if (isset($_GET['submitted']) && isset($_GET['loginName']) && isset($_GET['key'])) { //get the login name and key and verify if they match the ones in the database $key = $_GET['key']; $login_nicename = $_GET['loginName']; $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_activation_key = %s AND user_nicename = %s", $key, $login_nicename)); if (!empty($user)) { //check if the "finalAction" variable is not in the address bar, if it is, don't display the form anymore if (isset($_GET['finalAction']) && $_GET['finalAction'] == 'yes') { if ($messageNo2 == '2') { echo apply_filters('wppb_recover_password_password_changed_message2', '<p class="wppb-error">' . $message2 . '</p>', $message2); wppb_create_recover_password_form($user, $_POST); } elseif ($messageNo2 == '1') { echo apply_filters('wppb_recover_password_password_changed_message1', '<p class="wppb-success">' . $message2 . '</p>', $message2); } } else { wppb_create_recover_password_form($user, $_POST); } } else { if ($messageNo2 == '1') { if (PROFILE_BUILDER == 'Profile Builder Pro') { $wppb_module_settings = get_option('wppb_module_settings'); if (isset($wppb_module_settings['wppb_customRedirect']) && $wppb_module_settings['wppb_customRedirect'] == 'show' && function_exists('wppb_custom_redirect_url')) { $redirect_url = wppb_custom_redirect_url('after_success_password_reset', '', $_GET['loginName']); $redirect_url = apply_filters('wppb_after_success_password_reset_redirect_url', $redirect_url); if (isset($redirect_url) && !empty($redirect_url)) { $redirect_after_seconds = 3; echo apply_filters('wppb_after_success_password_reset_redirect_after_seconds', '<meta http-equiv="refresh" content="' . $redirect_after_seconds . '; url=' . $redirect_url . '">', $redirect_after_seconds); $before_redirect_message = 'You will soon be redirected automatically. If you see this page for more than ' . $redirect_after_seconds . ' seconds, please click <a href="' . $redirect_url . '">here</a>.'; $before_redirect_message = apply_filters('wppb_after_success_password_reset_before_redirect_message', $before_redirect_message); } } } echo apply_filters('wppb_recover_password_password_changed_message1', '<p class="wppb-success">' . $message2 . '</p>', $message2); if (isset($before_redirect_message) && !empty($before_redirect_message)) { echo '<p>' . $before_redirect_message . '</p>'; } } elseif ($messageNo2 == '2') { echo apply_filters('wppb_recover_password_password_changed_message2', '<p class="wppb-error">' . $message2 . '</p>', $message2); } else { echo apply_filters('wppb_recover_password_invalid_key_message', '<p class="wppb-warning"><b>' . __('ERROR:', 'profile-builder') . '</b>' . __('Invalid key!', 'profile-builder') . '</p>'); } } } else { //display error message and the form if ($messageNo == '' || $messageNo == '2' || $messageNo == '4') { if (!empty($message)) { echo apply_filters('wppb_recover_password_displayed_message1', '<p class="wppb-warning">' . $message . '</p>'); } wppb_create_generate_password_form($_POST); } elseif ($messageNo == '5' || $messageNo == '6') { echo apply_filters('wppb_recover_password_displayed_message1', '<p class="wppb-warning">' . $message . '</p>'); } else { echo apply_filters('wppb_recover_password_displayed_message2', '<p class="wppb-success">' . $message . '</p>'); } //display success message } // use this action hook to add extra content after the password recovery form. do_action('wppb_after_recover_password_fields'); ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }
function wppb_front_end_profile_info() { global $changesSaved; global $changesSavedNoMatchingPass; global $changesSavedNoPass; $editProfileFilterArray = array(); $editProfileFilterArray2 = array(); $extraFieldsErrorHolder = array(); //we will use this array to store the ID's of the extra-fields left uncompleted global $wppb_shortcode_on_front; //get "login with" setting $wppb_generalSettings = get_option('wppb_general_settings'); $wppb_shortcode_on_front = true; ob_start(); get_currentuserinfo(); $wppb_defaultOptions = get_option('wppb_default_settings'); $changesSavedNoEmail = 'no'; $changesSavedNoEmailExist = 'no'; $previousError = 'no'; $pictureUpload = 'no'; $avatarUpload = 'yes'; $allRequiredCompleted = 'yes'; $uploadName = array(); $uploadExt = array(); $uploadSize = array(); $editFilterArray = array(); $error = null; /* Get user info. */ global $current_user; /* delete the attachment if set */ if (isset($_GET['userID']) && isset($_GET['field'])) { update_user_meta($_GET['userID'], $_GET['field'], ''); } /* delete the avatar */ if (isset($_GET['userID']) && isset($_GET['fieldOriginal']) && isset($_GET['fieldResized'])) { update_user_meta($_GET['userID'], $_GET['fieldOriginal'], ''); update_user_meta($_GET['userID'], $_GET['fieldResized'], ''); } //fallback if the file was largen then post_max_size, case in which no errors can be saved in $_FILES[fileName]['error'] if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') { $editProfileFilterArray['noPost'] = '<p class="error">' . sprintf(__('The information size you were trying to submit was larger than %1$sb!<br/>This is usually caused by a large file(s) trying to be uploaded.<br/>Since it was also larger than %2$sb no additional information is available.<br/>The user was NOT created!', 'profilebuilder'), WPPB_SERVER_MAX_UPLOAD_SIZE_MEGA, WPPB_SERVER_MAX_POST_SIZE_MEGA) . '</p>'; echo $editProfileFilterArray['noPost'] = apply_filters('wppb_edit_profile_no_post_error', $editProfileFilterArray['noPost']); } //a way to catch the user before updating his/her profile without completing a required field if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'update-user' && wp_verify_nonce($_POST['edit_nonce_field'], 'verify_edit_user')) { //variable to control whether the user submitted data or not $allRequiredCompleted = apply_filters('wppb_edit_profile_all_required_completed', $allRequiredCompleted); if ($wppb_defaultOptions['firstname'] == 'show') { $_POST['first_name'] = apply_filters('wppb_edit_profile_posted_first_name_check', $_POST['first_name']); if ($wppb_defaultOptions['firstnameRequired'] == 'yes') { if (isset($_POST['first_name']) && trim($_POST['first_name']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['lastname'] == 'show') { $_POST['last_name'] = apply_filters('wppb_edit_profile_posted_last_name_check', $_POST['last_name']); if ($wppb_defaultOptions['lastnameRequired'] == 'yes') { if (isset($_POST['last_name']) && trim($_POST['last_name']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['nickname'] == 'show') { $_POST['nickname'] = apply_filters('wppb_edit_profile_posted_nickname_check', $_POST['nickname']); if ($wppb_defaultOptions['nicknameRequired'] == 'yes') { if (isset($_POST['nickname']) && trim($_POST['nickname']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['dispname'] == 'show') { $_POST['display_name'] = apply_filters('wppb_edit_profile_posted_display_name_check', $_POST['display_name']); if ($wppb_defaultOptions['dispnameRequired'] == 'yes') { if (isset($_POST['display_name']) && trim($_POST['display_name']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['website'] == 'show') { $_POST['website'] = apply_filters('wppb_edit_profile_posted_website_check', $_POST['website']); if ($wppb_defaultOptions['websiteRequired'] == 'yes') { if (isset($_POST['website']) && trim($_POST['website']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['aim'] == 'show') { $_POST['aim'] = apply_filters('wppb_edit_profile_posted_aim_check', $_POST['aim']); if ($wppb_defaultOptions['aimRequired'] == 'yes') { if (isset($_POST['aim']) && trim($_POST['aim']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['yahoo'] == 'show') { $_POST['yim'] = apply_filters('wppb_edit_profile_posted_yahoo_check', $_POST['yim']); if ($wppb_defaultOptions['yahooRequired'] == 'yes') { if (isset($_POST['yim']) && trim($_POST['yim']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['jabber'] == 'show') { $_POST['jabber'] = apply_filters('wppb_edit_profile_posted_jabber_check', $_POST['jabber']); if ($wppb_defaultOptions['jabberRequired'] == 'yes') { if (isset($_POST['jabber']) && trim($_POST['jabber']) == '') { $allRequiredCompleted = 'no'; } } } if ($wppb_defaultOptions['bio'] == 'show') { $_POST['description'] = apply_filters('wppb_edit_profile_posted_bio_check', $_POST['description']); if ($wppb_defaultOptions['bioRequired'] == 'yes') { if (isset($_POST['description']) && trim($_POST['description']) == '') { $allRequiredCompleted = 'no'; } } } /* also check the extra profile information */ $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_type'] . $value['id']] = apply_filters('wppb_edit_profile_input_custom_field_' . $value['id'] . '_check', $_POST[$value['item_type'] . $value['id']]); if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } 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 (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($checkboxOption) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "radio": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "select": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "countrySelect": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "timeZone": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "datepicker": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "textarea": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "upload": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { $uploadedfile = $value['item_type'] . $value['id']; if (basename($_FILES[$uploadedfile]['name']) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; case "avatar": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { $uploadedfile = $value['item_type'] . $value['id']; if (basename($_FILES[$uploadedfile]['name']) == '') { array_push($extraFieldsErrorHolder, $value['id']); $allRequiredCompleted = 'no'; } } } break; } } } $allRequiredCompleted = apply_filters('wppb_edit_profile_all_required_completed_after_check', $allRequiredCompleted); } /* If profile was saved, update profile. */ if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'update-user' && wp_verify_nonce($_POST['edit_nonce_field'], 'verify_edit_user') && $allRequiredCompleted == 'yes') { if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { } else { $_POST['email'] = apply_filters('wppb_edit_profile_posted_email', $_POST['email']); if ($wppb_defaultOptions['emailRequired'] == 'yes') { if (trim($_POST['email']) != '' && isset($_POST['email'])) { if (email_exists($_POST['email']) != FALSE) { $thisEmail = email_exists($_POST['email']); } else { $thisEmail = $current_user->id; } if (!empty($_POST['email']) && is_email($_POST['email'])) { // if the user entered a valid email address if ($thisEmail == $current_user->id) { // if the entered email address is not already registered to some other user wp_update_user(array('ID' => $current_user->id, 'user_email' => esc_attr($_POST['email']))); $changesSaved = 'yes'; } else { $changesSavedNoEmailExist = 'yes'; } } else { $changesSavedNoEmail = 'yes'; } } } else { if (email_exists($_POST['email']) != FALSE) { $thisEmail = email_exists($_POST['email']); } else { $thisEmail = $current_user->id; } if (!empty($_POST['email']) && is_email($_POST['email'])) { // if the user entered a valid email address if ($thisEmail == $current_user->id) { // if the entered email address is not already registered to some other user wp_update_user(array('ID' => $current_user->id, 'user_email' => esc_attr($_POST['email']))); $changesSaved = 'yes'; } else { $changesSavedNoEmailExist = 'yes'; } } else { $changesSavedNoEmail = 'yes'; } } } /* Update user information. */ if ($wppb_defaultOptions['firstname'] == 'show') { $_POST['first_name'] = apply_filters('wppb_edit_profile_posted_first_name', $_POST['first_name']); if ($wppb_defaultOptions['firstnameRequired'] == 'yes') { if (isset($_POST['first_name']) && trim($_POST['first_name']) != '') { wp_update_user(array('ID' => $current_user->id, 'first_name' => esc_attr($_POST['first_name']))); $changesSaved = 'yes'; } } else { wp_update_user(array('ID' => $current_user->id, 'first_name' => esc_attr($_POST['first_name']))); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['lastname'] == 'show') { $_POST['last_name'] = apply_filters('wppb_edit_profile_posted_last_name', $_POST['last_name']); if ($wppb_defaultOptions['lastnameRequired'] == 'yes') { if (isset($_POST['last_name']) && trim($_POST['last_name']) != '') { wp_update_user(array('ID' => $current_user->id, 'last_name' => esc_attr($_POST['last_name']))); $changesSaved = 'yes'; } } else { wp_update_user(array('ID' => $current_user->id, 'last_name' => esc_attr($_POST['last_name']))); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['nickname'] == 'show') { $_POST['nickname'] = apply_filters('wppb_edit_profile_posted_nickname', $_POST['nickname']); if ($wppb_defaultOptions['nicknameRequired'] == 'yes') { if (isset($_POST['nickname']) && trim($_POST['nickname']) != '') { wp_update_user(array('ID' => $current_user->id, 'nickname' => esc_attr($_POST['nickname']))); $changesSaved = 'yes'; } } else { wp_update_user(array('ID' => $current_user->id, 'nickname' => esc_attr($_POST['nickname']))); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['dispname'] == 'show') { $_POST['display_name'] = apply_filters('wppb_edit_profile_posted_display_name', $_POST['display_name']); if ($wppb_defaultOptions['dispnameRequired'] == 'yes') { if (isset($_POST['display_name']) && trim($_POST['display_name']) != '') { wp_update_user(array('ID' => $current_user->id, 'display_name' => esc_attr($_POST['display_name']))); $changesSaved = 'yes'; } } else { wp_update_user(array('ID' => $current_user->id, 'display_name' => esc_attr($_POST['display_name']))); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['website'] == 'show') { $_POST['website'] = apply_filters('wppb_edit_profile_posted_website', $_POST['website']); if ($wppb_defaultOptions['websiteRequired'] == 'yes') { if (isset($_POST['website']) && trim($_POST['website']) != '') { $wppbPos = strpos((string) $_POST['website'], 'http://'); if ($wppbPos !== FALSE) { wp_update_user(array('ID' => $current_user->id, 'user_url' => esc_attr($_POST['website']))); $changesSaved = 'yes'; } else { wp_update_user(array('ID' => $current_user->id, 'user_url' => 'http://' . esc_attr($_POST['website']))); $changesSaved = 'yes'; } } } else { $wppbPos = strpos((string) $_POST['website'], 'http://'); $website = esc_attr($_POST['website']); if ($wppbPos !== FALSE) { if ($website == 'http://') { $website = ''; } wp_update_user(array('ID' => $current_user->id, 'user_url' => $website)); $changesSaved = 'yes'; } else { if ($website != '') { $website = 'http://' . $website; } wp_update_user(array('ID' => $current_user->id, 'user_url' => $website)); $changesSaved = 'yes'; } } } if ($wppb_defaultOptions['aim'] == 'show') { $_POST['aim'] = apply_filters('wppb_edit_profile_posted_aim', $_POST['aim']); if ($wppb_defaultOptions['aimRequired'] == 'yes') { if (isset($_POST['aim']) && trim($_POST['aim']) != '') { update_user_meta($current_user->id, 'aim', esc_attr($_POST['aim'])); $changesSaved = 'yes'; } } else { update_user_meta($current_user->id, 'aim', esc_attr($_POST['aim'])); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['yahoo'] == 'show') { $_POST['yim'] = apply_filters('wppb_edit_profile_posted_yahoo', $_POST['yim']); if ($wppb_defaultOptions['yahooRequired'] == 'yes') { if (isset($_POST['yim']) && trim($_POST['yim']) != '') { update_user_meta($current_user->id, 'yim', esc_attr($_POST['yim'])); $changesSaved = 'yes'; } } else { update_user_meta($current_user->id, 'yim', esc_attr($_POST['yim'])); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['jabber'] == 'show') { $_POST['jabber'] = apply_filters('wppb_edit_profile_posted_jabber', $_POST['jabber']); if ($wppb_defaultOptions['jabberRequired'] == 'yes') { if (isset($_POST['jabber']) && trim($_POST['jabber']) != '') { update_user_meta($current_user->id, 'jabber', esc_attr($_POST['jabber'])); $changesSaved = 'yes'; } } else { update_user_meta($current_user->id, 'jabber', esc_attr($_POST['jabber'])); $changesSaved = 'yes'; } } if ($wppb_defaultOptions['bio'] == 'show') { $_POST['description'] = apply_filters('wppb_edit_profile_posted_bio', $_POST['description']); if ($wppb_defaultOptions['bioRequired'] == 'yes') { if (isset($_POST['description']) && trim($_POST['description']) != '') { update_user_meta($current_user->id, 'description', esc_attr($_POST['description'])); $changesSaved = 'yes'; } } else { update_user_meta($current_user->id, 'description', esc_attr($_POST['description'])); $changesSaved = 'yes'; } } /* update the extra profile information */ $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_type'] . $value['id']] = apply_filters('wppb_edit_profile_input_custom_field_' . $value['id'], $_POST[$value['item_type'] . $value['id']]); if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "hiddenInput": update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); break; case "checkbox": $checkboxOption = ''; $value['item_options'] = wppb_icl_t('plugin profile-builder-pro', 'custom_field_' . $id . '_options_translation', $value['item_options']); $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 (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($checkboxOption) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($checkboxOption)); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($checkboxOption)); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($checkboxOption)); } break; case "radio": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "select": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "countrySelect": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "timeZone": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "datepicker": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "textarea": if (isset($value['item_required'])) { if ($value['item_required'] == 'yes') { if (trim($_POST[$value['item_type'] . $value['id']]) != '') { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } else { array_push($extraFieldsErrorHolder, $value['id']); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } } else { update_user_meta($current_user->id, $value['item_metaName'], esc_attr($_POST[$value['item_type'] . $value['id']])); } break; case "upload": $uploadedfile = $value['item_type'] . $value['id']; //get allowed file types if ($value['item_options'] != NULL || $value['item_options'] != '') { $allFiles = false; $extensions = explode(',', $value['item_options']); foreach ($extensions as $key3 => $value3) { $extensions[$key3] = trim($value3); } } else { $allFiles = true; } //first we need to verify if we don't try to upload a 0b or 0 length file if (basename($_FILES[$uploadedfile]['name']) != '') { //get this attachments extension $thisFileExtStart = strrpos($_FILES[$uploadedfile]['name'], '.'); $thisFileExt = substr($_FILES[$uploadedfile]['name'], $thisFileExtStart); if ($allFiles === false) { if (in_array($thisFileExt, $extensions)) { //second we need to verify if the uploaded file size is less then the set file size in php.ini if ($_FILES[$uploadedfile]['size'] < WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE && $_FILES[$uploadedfile]['size'] != 0) { //we need to prepare the basename of the file, so that ' becomes ` as ' gives an error $fileName = basename($_FILES[$uploadedfile]['name']); $finalFileName = ''; for ($i = 0; $i < strlen($fileName); $i++) { if ($fileName[$i] == "'") { $finalFileName .= '`'; } else { $finalFileName .= $fileName[$i]; } } //create the target path for uploading $wpUploadPath = wp_upload_dir(); // Array of key => value pairs $target_path = $wpUploadPath['basedir'] . "/profile_builder/attachments/"; $target_path = $target_path . 'userID_' . $current_user->id . '_attachment_' . $finalFileName; if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)) { $upFile = $wpUploadPath['baseurl'] . '/profile_builder/attachments/userID_' . $current_user->id . '_attachment_' . $finalFileName; update_user_meta($current_user->id, $value['item_metaName'], $upFile); $pictureUpload = 'yes'; } else { //insert the name of the file in an array so that in case an error comes up, we know which files we just uploaded array_push($uploadName, basename($_FILES[$uploadedfile]['name'])); } } else { //insert the name of the file in an array so that in case an error comes up, we know which files we just uploaded array_push($uploadName, basename($_FILES[$uploadedfile]['name'])); } } else { array_push($uploadExt, basename($_FILES[$uploadedfile]['name'])); $allowedExtensions = ''; (int) ($nrOfExt = count($extensions) - 2); foreach ($extensions as $key4 => $value4) { $allowedExtensions .= $value4; if ($key4 <= $nrOfExt) { $allowedExtensions .= ', '; } } } } else { //second we need to verify if the uploaded file size is less then the set file size in php.ini if ($_FILES[$uploadedfile]['size'] < WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE && $_FILES[$uploadedfile]['size'] != 0) { //we need to prepare the basename of the file, so that ' becomes ` as ' gives an error $fileName = basename($_FILES[$uploadedfile]['name']); $finalFileName = ''; for ($i = 0; $i < strlen($fileName); $i++) { if ($fileName[$i] == "'") { $finalFileName .= '`'; } else { $finalFileName .= $fileName[$i]; } } //create the target path for uploading $wpUploadPath = wp_upload_dir(); // Array of key => value pairs $target_path = $wpUploadPath['basedir'] . "/profile_builder/attachments/"; $target_path = $target_path . 'userID_' . $current_user->id . '_attachment_' . $finalFileName; if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)) { $upFile = $wpUploadPath['baseurl'] . '/profile_builder/attachments/userID_' . $current_user->id . '_attachment_' . $finalFileName; update_user_meta($current_user->id, $value['item_metaName'], $upFile); $pictureUpload = 'yes'; } else { //insert the name of the file in an array so that in case an error comes up, we know which files we just uploaded array_push($uploadName, basename($_FILES[$uploadedfile]['name'])); } } else { //insert the name of the file in an array so that in case an error comes up, we know which files we just uploaded array_push($uploadName, basename($_FILES[$uploadedfile]['name'])); } } } break; case "avatar": $avatarUpload = 'no'; $uploadedfile = $value['item_type'] . $value['id']; $wpUploadPath = wp_upload_dir(); // Array of key => value pairs $target_path_original = $wpUploadPath['basedir'] . "/profile_builder/avatars/"; $fileName = $_FILES[$uploadedfile]['name']; $finalFileName = ''; for ($i = 0; $i < strlen($fileName); $i++) { if ($fileName[$i] == "'") { $finalFileName .= '`'; } elseif ($fileName[$i] == ' ') { $finalFileName .= '_'; } else { $finalFileName .= $fileName[$i]; } } $fileName = $finalFileName; $target_path = $target_path_original . 'userID_' . $current_user->id . '_originalAvatar_' . $fileName; /* when trying to upload file, be sure it's one of the accepted image file-types */ 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') && ($_FILES[$uploadedfile]['size'] < WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE && $_FILES[$uploadedfile]['size'] != 0)) { $avatarUpload = 'yes'; $wp_filetype = wp_check_filetype(basename($_FILES[$uploadedfile]['name']), null); $attachment = array('post_mime_type' => $wp_filetype['type'], 'post_title' => $fileName, 'post_content' => '', 'post_status' => 'inherit'); $attach_id = wp_insert_attachment($attachment, $target_path); $upFile = image_downsize($attach_id, 'thumbnail'); $upFile = $upFile[0]; //if file upload succeded if (move_uploaded_file($_FILES[$uploadedfile]['tmp_name'], $target_path)) { update_user_meta($current_user->id, $value['item_metaName'], $upFile); update_user_meta($current_user->id, 'resized_avatar_' . $value['id'], ''); } else { $avatarUpload = 'no'; } } elseif (($_FILES[$uploadedfile]['size'] > WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE || $_FILES[$uploadedfile]['size'] == 0) && $fileName != '') { $avatarUpload = 'no'; } elseif ($fileName == '') { $avatarUpload = 'yes'; } break; } } } } ?> <div class="wppb_holder" id="wppb_modify"> <?php if (!is_user_logged_in()) { $editProfileFilterArray['notLoggedIn'] = ' <p class="warning">' . __('You must be logged in to edit your profile.', 'profilebuilder') . '</p><!-- .warning -->'; echo $editProfileFilterArray['notLoggedIn'] = apply_filters('wppb_edit_profile_user_not_logged_in', $editProfileFilterArray['notLoggedIn']); } else { /* messages for the the delete avatar/attachment */ if (isset($_GET['fileType'])) { if ($_GET['fileType'] == 'avatar') { $editProfileFilterArray['avatarChangesSaved'] = ' <p class="changes-saved">' . __('The avatar was successfully deleted.', 'profilebuilder') . '</p><!-- .changes-saved -->'; echo $editProfileFilterArray['avatarChangesSaved'] = apply_filters('wppb_edit_profile_avatar_changes_saved', $editProfileFilterArray['avatarChangesSaved']); unset($_GET['fileType']); } elseif ($_GET['fileType'] == 'attachment') { $editProfileFilterArray['attachmentChangesSaved'] = '<p class="changes-saved">' . sprintf(__('The attachment "%1$s" was successfully deleted.', 'profilebuilder'), $_GET['fileName']) . '</p><!-- .changes-saved -->'; echo $editProfileFilterArray['attachmentChangesSaved'] = apply_filters('wppb_edit_profile_attachment_changes_saved', $editProfileFilterArray['attachmentChangesSaved']); unset($_GET['fileType']); unset($_GET['fileName']); } } /* all the other messages/errors */ $nrOfBadUploads = 0; $nrOfBadUploads = count($uploadName); $nrOfBadExtUploads = count($uploadExt); if ($changesSaved == 'yes' && $changesSavedNoMatchingPass == 'no' && $changesSavedNoPass == 'no' && $changesSavedNoEmail == 'no' && $changesSavedNoEmailExist == 'no' && $avatarUpload == 'yes' && $nrOfBadUploads == 0 && $nrOfBadExtUploads == 0) { $editProfileFilterArray['allChangesSaved'] = ' <p class="changes-saved">' . __('The changes have been successfully saved.', 'profilebuilder') . '</p><!-- .changes-saved -->'; echo $editProfileFilterArray['allChangesSaved'] = apply_filters('wppb_edit_profile_all_changes_saved', $editProfileFilterArray['allChangesSaved']); } elseif ($changesSaved == 'yes' && $changesSavedNoEmailExist == 'yes' && $previousError == 'no') { $editProfileFilterArray['allChangesSavedExceptExistingEmail'] = '<p class="semi-saved">' . sprintf(__('The email address you entered is already registered to a different user.%1$sThe email address was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<br/>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['allChangesSavedExceptExistingEmail'] = apply_filters('wppb_edit_profile_all_changes_saved_except_existing_email', $editProfileFilterArray['allChangesSavedExceptExistingEmail']); $previousError = 'yes'; } elseif ($changesSaved == 'yes' && $changesSavedNoEmail == 'yes' && $previousError == 'no') { $editProfileFilterArray['allChangesSavedExceptInvalidEmail'] = '<p class="semi-saved">' . sprintf(__('The email address you entered is invalid.%1$sThe email address was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<br/>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['allChangesSavedExceptInvalidEmail'] = apply_filters('wppb_edit_profile_all_changes_saved_except_invalid_email', $editProfileFilterArray['allChangesSavedExceptInvalidEmail']); $previousError = 'yes'; } elseif ($changesSaved == 'yes' && $changesSavedNoMatchingPass == 'yes' && $previousError == 'no') { $editProfileFilterArray['allChangesSavedMismatchedPass'] = '******' . sprintf(__('The passwords you entered do not match.%1$sThe password was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<br/>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['allChangesSavedMismatchedPass'] = apply_filters('wppb_edit_profile_all_changes_saved_except_mismatch_password', $editProfileFilterArray['allChangesSavedMismatchedPass']); $previousError = 'yes'; } elseif ($changesSaved == 'yes' && $changesSavedNoPass == 'yes' && $previousError == 'no') { $editProfileFilterArray['allChangesSavedUncompletedPass'] = '******' . sprintf(__('You didn\'t complete both password fields.%1$sThe password was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<br/>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['allChangesSavedUncompletedPass'] = apply_filters('wppb_edit_profile_all_changes_saved_except_uncompleted_password', $editProfileFilterArray['allChangesSavedUncompletedPass']); $previousError = 'yes'; } elseif ($allRequiredCompleted == 'no') { $editProfileFilterArray['errorSavingChanges'] = '<p class="error">' . $errorMessage . '<br/>' . __('Your profile was NOT updated, since not all required fields were completed!', 'profilebuilder') . '</p><!-- .error -->'; echo $editProfileFilterArray['errorSavingChanges'] = apply_filters('wppb_edit_profile_error_saving_changes', $editProfileFilterArray['errorSavingChanges']); } $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/'; if (file_exists($wppb_premium . 'extra.fields.php')) { if ($changesSaved == 'yes' && $nrOfBadUploads > 0 && $previousError == 'no') { $lastOne = 0; $editProfileFilterArray['errorUploadingAttachments'] = ' <p class="semi-saved">' . __('There was an error while trying to upload the following attachments:', 'profilebuilder') . '<br/> <span class="error">'; foreach ($uploadName as $key => $name) { $lastOne++; $editProfileFilterArray['errorUploadingAttachments'] .= $name; if ($nrOfBadUploads - $lastOne > 0) { $editProfileFilterArray['errorUploadingAttachments'] .= ';<span style="padding-left:10px"></span>'; } } $editProfileFilterArray['errorUploadingAttachments'] .= '</span><br/>' . sprintf(__('Possible cause: the size was bigger than %1$sb. The listed attachements were %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), WPPB_SERVER_MAX_UPLOAD_SIZE_MEGA, '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['errorUploadingAttachments'] = apply_filters('wppb_edit_profile_error_uploading_attachments', $editProfileFilterArray['errorUploadingAttachments']); $previousError = 'yes'; } if ($changesSaved == 'yes' && $avatarUpload == 'no' && $previousError == 'no') { $editProfileFilterArray['errorUploadingAvatar'] = ' <p class="semi-saved">' . __('There was an error while trying to upload your avatar picture.', 'profilebuilder') . '<br/>' . __('Possible cause: size/incorrect file-type.', 'profilebuilder') . '<br/>' . __('The avatar was', 'profilebuilder') . ' <span class="error">' . __('NOT', 'profilebuilder') . '</span> ' . __('updated along with the rest of the information.', 'profilebuilder') . ' </p>'; echo $editProfileFilterArray['errorUploadingAvatar'] = apply_filters('wppb_edit_profile_error_uploading_avatar', $editProfileFilterArray['errorUploadingAvatar']); $previousError = 'yes'; } elseif ($changesSaved == 'yes' && $nrOfBadExtUploads != 0 && $previousError == 'no') { $editProfileFilterArray['errorUploadingAttachmentExts'] = ' <p class="semi-saved">' . __('There was an error while trying to upload the following attachment(s)', 'profilebuilder') . ': <span class="error">'; foreach ($uploadExt as $key5 => $name5) { $lastOne++; $editProfileFilterArray['errorUploadingAttachmentExts'] .= $name5; if ($nrOfBadExtUploads - $lastOne > 0) { $editProfileFilterArray['errorUploadingAttachmentExts'] .= ';<span style="padding-left:10px"></span>'; } } $editProfileFilterArray['errorUploadingAttachmentExts'] .= '</span><br/>' . sprintf(__('Only files with the following extension(s) can be uploaded: %1$s<br/>This file was %2$sNOT%3$s updated along with the rest of the information.', 'profilebuilder'), '<span class="error">' . $allowedExtensions . '</span>', '<span class="error">', '</span>') . '</p>'; echo $editProfileFilterArray['errorUploadingAttachmentExts'] = apply_filters('wppb_edit_profile_error_uploading_attachment', $editProfileFilterArray['errorUploadingAttachmentExts']); $previousError = 'yes'; } } /* use this action hook to add extra content before the edit profile form. */ do_action('wppb_before_edit_profile_fields'); ?> <form enctype="multipart/form-data" method="post" id="edituser" class="user-forms" action="<?php wppb_curpageurl(); ?> "> <?php echo '<input type="hidden" name="MAX_FILE_SIZE" value="' . WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE . '" /><!-- set the MAX_FILE_SIZE to the server\'s current max upload size in bytes -->'; $editProfileFilterArray2['contentName1'] = '<p class="nameHeader"><strong>' . __('Name', 'profilebuilder') . '</strong></p>'; $editProfileFilterArray2['contentName1'] = apply_filters('wppb_edit_profile_content_name1', $editProfileFilterArray2['contentName1']); if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { if ($wppb_defaultOptions['email'] == 'show') { $editProfileFilterArray2['contentName2'] = ' <p class="email"> <label for="email">' . __('Email', 'profilebuilder') . '</label> <input class="text-input" name="email" type="text" id="email" value="' . get_the_author_meta('user_email', $current_user->id) . '" disabled="disabled"/> <span class="wppb-description-delimiter"> ' . __('The email cannot be changed.', 'profilebuilder') . '</span> </p><!-- .first_name -->'; $editProfileFilterArray2['contentName2'] = apply_filters('wppb_edit_profile_content_name2_with_email', $editProfileFilterArray2['contentName2'], $current_user->id); } } else { if ($wppb_defaultOptions['username'] == 'show') { $editProfileFilterArray2['contentName2'] = ' <p class="username"> <label for="user_login">' . __('Username', 'profilebuilder') . '</label> <input class="text-input" name="user_login" type="text" id="user_login" value="' . get_the_author_meta('user_login', $current_user->id) . '" disabled="disabled"/> <span class="wppb-description-delimiter"> ' . __('The usernames cannot be changed.', 'profilebuilder') . '</span> </p><!-- .first_name -->'; $editProfileFilterArray2['contentName2'] = apply_filters('wppb_edit_profile_content_name2', $editProfileFilterArray2['contentName2'], $current_user->id); } } if ($wppb_defaultOptions['firstname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['firstnameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['first_name'])) { if (trim($_POST['first_name']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['contentName3'] = ' <p class="first_name' . $errorVar . '"> <label for="first_name">' . __('First Name', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="first_name" type="text" id="first_name" value="' . get_the_author_meta('first_name', $current_user->id) . '" /> </p><!-- .first_name -->'; $editProfileFilterArray2['contentName3'] = apply_filters('wppb_edit_profile_content_name3', $editProfileFilterArray2['contentName3'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['lastname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['lastnameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['last_name'])) { if (trim($_POST['last_name']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['contentName4'] = ' <p class="last_name' . $errorVar . '"> <label for="last_name">' . __('Last Name', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="last_name" type="text" id="last_name" value="' . get_the_author_meta('last_name', $current_user->id) . '" /> </p><!-- .last_name -->'; $editProfileFilterArray2['contentName4'] = apply_filters('wppb_edit_profile_content_name4', $editProfileFilterArray2['contentName4'], $current_user->id); } if ($wppb_defaultOptions['nickname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['nicknameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['nickname'])) { if (trim($_POST['nickname']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['contentName5'] = ' <p class="nickname' . $errorVar . '"> <label for="nickname">' . __('Nickname', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="nickname" type="text" id="nickname" value="' . get_the_author_meta('nickname', $current_user->id) . '" /> </p><!-- .nickname -->'; $editProfileFilterArray2['contentName5'] = apply_filters('wppb_edit_profile_content_name5', $editProfileFilterArray2['contentName5'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['dispname'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['dispnameRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['display_name'])) { if (trim($_POST['display_name']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['displayName'] = ' <p class="display_name' . $errorVar . '"> <label for="display_name">' . __('Display name publicly as', 'profilebuilder') . $errorMark . '</label> <select name="display_name" id="display_name">'; $public_display = array(); $public_display['display_username'] = get_the_author_meta('user_login', $current_user->id); $thisFirstName = get_the_author_meta('first_name', $current_user->id); if (!empty($thisFirstName)) { $public_display['display_firstname'] = get_the_author_meta('first_name', $current_user->id); } $thisLastName = get_the_author_meta('last_name', $current_user->id); if (!empty($thisLastName)) { $public_display['display_lastname'] = get_the_author_meta('last_name', $current_user->id); } $public_display['display_nickname'] = get_the_author_meta('nickname', $current_user->id); if (!empty($thisFirstName) && !empty($thisLastName)) { $public_display['display_firstlast'] = $thisFirstName . ' ' . $thisLastName; $public_display['display_lastfirst'] = $thisLastName . ' ' . $thisFirstName; } $thisDisplayName = get_the_author_meta('display_name', $current_user->id); if (!in_array($thisDisplayName, $public_display)) { // Only add this if it isn't duplicated elsewhere $public_display = array('display_displayname' => $thisDisplayName) + $public_display; } $public_display = array_map('trim', $public_display); foreach ($public_display as $id => $item) { $editProfileFilterArray2['displayName'] .= '<option id="' . $id . '" value="' . $item . '"'; if ($thisDisplayName == $item) { $editProfileFilterArray2['displayName'] .= ' selected'; } $editProfileFilterArray2['displayName'] .= '>' . $item . '</option>'; } $editProfileFilterArray2['displayName'] .= ' </select> </p><!-- .display_name -->'; $editProfileFilterArray2['displayName'] = apply_filters('wppb_edit_profile_display_name', $editProfileFilterArray2['displayName'], $current_user->id, $errorVar, $errorMark); } $editProfileFilterArray2['contentInfo1'] = '<p class="contactInfoHeader"><strong>' . __('Contact Info', 'profilebuilder') . '</strong></p>'; $editProfileFilterArray2['contentInfo1'] = apply_filters('wppb_edit_profile_content_info1', $editProfileFilterArray2['contentInfo1']); if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { } else { if ($wppb_defaultOptions['email'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['emailRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['email'])) { if (trim($_POST['email']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } } $editProfileFilterArray2['contentInfo2'] = ' <p class="form-email' . $errorVar . '"> <label for="email">' . __('E-mail', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="email" type="text" id="email" value="' . get_the_author_meta('user_email', $current_user->id) . '" /> <span class="wppb-description-delimiter">' . __('(required)', 'profilebuilder') . '</span> </p><!-- .form-email -->'; $editProfileFilterArray2['contentInfo2'] = apply_filters('wppb_edit_profile_content_info2', $editProfileFilterArray2['contentInfo2'], $current_user->id, $errorVar, $errorMark); } } if ($wppb_defaultOptions['website'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['websiteRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['website']) && trim($_POST['website']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['contentInfo3'] = ' <p class="form-website' . $errorVar . '"> <label for="website">' . __('Website', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="website" type="text" id="website" value="' . get_the_author_meta('user_url', $current_user->id) . '" /> </p><!-- .form-website -->'; $editProfileFilterArray2['contentInfo3'] = apply_filters('wppb_edit_profile_content_info3', $editProfileFilterArray2['contentInfo3'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['aim'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['aimRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['aim']) && trim($_POST['aim']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['contentInfo4'] = ' <p class="form-aim' . $errorVar . '"> <label for="aim">' . __('AIM', 'profilebuilder') . '</label> <input class="text-input" name="aim" type="text" id="aim" value="' . get_the_author_meta('aim', $current_user->id) . '" /> </p><!-- .form-aim -->'; $editProfileFilterArray2['contentInfo4'] = apply_filters('wppb_edit_profile_content_info4', $editProfileFilterArray2['contentInfo4'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['yahoo'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['yahooRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['yim']) && trim($_POST['yim']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['contentInfo5'] = ' <p class="form-yim' . $errorVar . '"> <label for="yim">' . __('Yahoo IM', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="yim" type="text" id="yim" value="' . get_the_author_meta('yim', $current_user->id) . '" /> </p><!-- .form-yim -->'; $editProfileFilterArray2['contentInfo5'] = apply_filters('wppb_edit_profile_content_info5', $editProfileFilterArray2['contentInfo5'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['jabber'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['jabberRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['jabber']) && trim($_POST['jabber']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['contentInfo6'] = ' <p class="form-jabber' . $errorVar . '"> <label for="jabber">' . __('Jabber / Google Talk', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="jabber" type="text" id="jabber" value="' . get_the_author_meta('jabber', $current_user->id) . '" /> </p><!-- .form-jabber -->'; $editProfileFilterArray2['contentInfo6'] = apply_filters('wppb_edit_profile_content_info6', $editProfileFilterArray2['contentInfo6'], $current_user->id, $errorVar, $errorMark); } $editProfileFilterArray2['aboutYourself1'] = '<p class="aboutYourselfHeader"><strong>' . __('About Yourself', 'profilebuilder') . '</strong></p>'; $editProfileFilterArray2['aboutYourself1'] = apply_filters('wppb_edit_profile_content_about_yourself1', $editProfileFilterArray2['aboutYourself1']); if ($wppb_defaultOptions['bio'] == 'show') { $errorVar = ''; $errorMark = ''; if ($wppb_defaultOptions['bioRequired'] == 'yes') { $errorMark = '<font color="red" title="' . __('This field is marked as required by the administrator.', 'profilebuilder') . '">*</font>'; if (isset($_POST['description']) && trim($_POST['description']) == '') { $errorMark = '<img src="' . WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="' . __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') . '"/>'; $errorVar = ' errorHolder'; } } $editProfileFilterArray2['aboutYourself2'] = ' <p class="form-description' . $errorVar . '"> <label for="description">' . __('Biographical Info', 'profilebuilder') . $errorMark . '</label> <textarea class="text-input" name="description" id="description" rows="5" cols="30">' . get_the_author_meta('description', $current_user->id) . '</textarea> </p><!-- .form-description -->'; $editProfileFilterArray2['aboutYourself2'] = apply_filters('wppb_edit_profile_content_about_yourself2', $editProfileFilterArray2['aboutYourself2'], $current_user->id, $errorVar, $errorMark); } if ($wppb_defaultOptions['password'] == 'show') { $editProfileFilterArray2['aboutYourself3'] = ' <p class="form-password"> <label for="pass1">' . __('New Password', 'profilebuilder') . '</label> <input class="text-input" name="pass1" type="password" id="pass1" /> </p><!-- .form-password --> <p class="form-password' . $errorVar . '"> <label for="pass2">' . __('Repeat Password', 'profilebuilder') . $errorMark . '</label> <input class="text-input" name="pass2" type="password" id="pass2" /> </p><!-- .form-password -->'; $editProfileFilterArray2['aboutYourself3'] = apply_filters('wppb_edit_profile_content_about_yourself3', $editProfileFilterArray2['aboutYourself3'], $errorVar, $errorMark); } $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/'; if (file_exists($wppb_premium . 'extra.fields.php')) { require_once $wppb_premium . 'extra.fields.php'; $page = 'edit_profile'; $returnedValue = wppb_extra_fields($current_user->id, $extraFieldsErrorHolder, $editProfileFilterArray2, $page, $error, $_POST); //copy over extra fields to the rest of the fieldso on the edit profile foreach ($returnedValue as $key => $value) { $editProfileFilterArray2[$key] = apply_filters('wppb_edit_profile_content_' . $key, $value, $returnedValue, $key); } } /* additional filter, just in case it is needed */ $editProfileFilterArray2['extraEditProfileFilter'] = ''; $editProfileFilterArray2['extraEditProfileFilter'] = apply_filters('extraEditProfileFilter', $editProfileFilterArray2['extraEditProfileFilter']); /* END additional filter, just in case it is needed */ $editProfileFilterArray2 = apply_filters('wppb_edit_profile', $editProfileFilterArray2); foreach ($editProfileFilterArray2 as $key => $value) { echo $value; } ?> <p class="form-submit"> <input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profilebuilder'); ?> " /> <?php // wp_nonce_field( 'update-user' ) ?> <input name="action" type="hidden" id="action" value="update-user" /> </p><!-- .form-submit --> <?php wp_nonce_field('verify_edit_user', 'edit_nonce_field'); ?> </form><!-- #edituser --> <?php //use this action hook to add extra content after the edit profile form. do_action('wppb_after_edit_profile_fields'); } ?> </div> <!--------------------------------------------------------------------------------------> <script src="/wp-content/plugins/profile-builder-pro/assets/js/ksk_phone.js" type="text/javascript"></script> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }
function wppb_front_end_login($atts) { extract(shortcode_atts(array('display' => true, 'redirect' => '', 'redirect_url' => '', 'register_url' => '', 'lostpassword_url' => ''), $atts)); $wppb_generalSettings = get_option('wppb_general_settings'); if (!is_user_logged_in()) { // set up the form arguments $form_args = array('echo' => false, 'id_submit' => 'wppb-submit'); //Add support for "redirect_url" parameter for Login shortcode (will do the same thing as "redirect" - for consistency with Register, Edit Profile shortcodes) if (!empty($redirect_url)) { $redirect = $redirect_url; } // maybe set up the redirect argument if (empty($redirect)) { if (PROFILE_BUILDER == 'Profile Builder Pro') { $wppb_module_settings = get_option('wppb_module_settings'); if ($wppb_module_settings['wppb_customRedirect'] == 'show') { //check to see if the redirect location is not an empty string and is activated $login_redirect_settings = get_option('customRedirectSettings'); // set up the redirect argument to our redirect page if (trim($login_redirect_settings['afterLoginTarget']) != '' && $login_redirect_settings['afterLogin'] == 'yes') { $redirect_to = trim($login_redirect_settings['afterLoginTarget']); if (wppb_check_missing_http($redirect_to)) { $redirect_to = 'http://' . $redirect_to; } $form_args['redirect'] = $redirect_to; } } } } else { $form_args['redirect'] = trim($redirect); } // change the label argument for username is login with email is enabled if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { $form_args['label_username'] = __('Email', 'profile-builder'); } // change the label argument for username on login with username or email when Username and Email is enabled if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'usernameemail') { $form_args['label_username'] = __('Username or Email', 'profile-builder'); } // initialize our form variable $login_form = ''; // display our login errors if (isset($_GET['loginerror']) || isset($_POST['loginerror'])) { $loginerror = isset($_GET['loginerror']) ? $_GET['loginerror'] : $_POST['loginerror']; $loginerror = '<p class="wppb-error">' . urldecode(base64_decode($loginerror)) . '</p><!-- .error -->'; if (isset($_GET['request_form_location'])) { if ($_GET['request_form_location'] == 'widget' && !in_the_loop()) { $login_form .= $loginerror; } elseif ($_GET['request_form_location'] == 'page' && in_the_loop()) { $login_form .= $loginerror; } } } // build our form $login_form .= '<div id="wppb-login-wrap" class="wppb-user-forms">'; $form_args['lostpassword_url'] = $lostpassword_url; $login_form .= wp_login_form(apply_filters('wppb_login_form_args', $form_args)); if (!empty($register_url) || !empty($lostpassword_url)) { $login_form .= '<p class="login-register-lost-password">'; $i = 0; if (!empty($register_url)) { if (wppb_check_missing_http($register_url)) { $register_url = "http://" . $register_url; } $login_form .= '<a href="' . esc_url($register_url) . '">' . apply_filters('wppb_login_register_text', __('Register', 'profile-builder')) . '</a>'; $i++; } if (!empty($lostpassword_url)) { if ($i != 0) { $login_form .= ' | '; } if (wppb_check_missing_http($lostpassword_url)) { $lostpassword_url = "http://" . $lostpassword_url; } $login_form .= '<a href="' . esc_url($lostpassword_url) . '">' . apply_filters('wppb_login_lostpass_text', __('Lost your password?', 'profile-builder')) . '</a>'; } $login_form .= '</p>'; } $login_form .= '</div>'; return $login_form; } else { $user_ID = get_current_user_id(); $wppb_user = get_userdata($user_ID); if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { $display_name = $wppb_user->user_email; } elseif ($wppb_user->display_name !== '') { $display_name = $wppb_user->user_login; } else { $display_name = $wppb_user->display_name; } if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'usernameemail') { if ($wppb_user->user_login == Wordpress_Creation_Kit_PB::wck_generate_slug(trim($wppb_user->user_email))) { $display_name = $wppb_user->user_email; } elseif ($wppb_user->display_name !== '') { $display_name = $wppb_user->user_login; } else { $display_name = $wppb_user->display_name; } } $logged_in_message = '<p class="wppb-alert">'; $logout_url = '<a href="' . wp_logout_url($redirectTo = wppb_curpageurl()) . '" class="wppb-logout-url" title="' . __('Log out of this account', 'profile-builder') . '">' . __('Log out', 'profile-builder') . ' »</a>'; $logged_in_message .= sprintf(__('You are currently logged in as %1$s. %2$s', 'profile-builder'), $display_name, $logout_url); $logged_in_message .= '</p><!-- .wppb-alert-->'; return apply_filters('wppb_login_message', $logged_in_message, $wppb_user->ID, $display_name); } }
/** ************************************************************************ * Recommended. This is a custom column method and is responsible for what * is rendered in any column with a name/slug of 'username'. Every time the class * needs to render a column, it first looks for a method named * column_{$column_title} - if it exists, that method is run. If it doesn't * exist, column_default() is called instead. * * This example also illustrates how to implement rollover actions. Actions * should be an associative array formatted as 'slug'=>'link html' - and you * will need to generate the URLs yourself. You could even ensure the links * * * @see PB_WP_List_Table::::single_row_columns() * @param array $item A singular item (one full row's worth of data) * @return string Text to be placed inside the column <td> **************************************************************************/ function column_username($item) { $GRavatar = get_avatar($item['email'], 32, ''); //Build row actions $actions = array('delete' => sprintf('<a href="javascript:confirmECAction( \'%s\', \'%s\', \'%s\', \'' . addslashes(__('delete this user from the _signups table?', 'profile-builder')) . '\' )">' . __('Delete', 'profile-builder') . '</a>', wppb_curpageurl(), 'delete', $item['ID']), 'confirm' => sprintf('<a href="javascript:confirmECAction( \'%s\', \'%s\', \'%s\', \'' . addslashes(__('confirm this email yourself?', 'profile-builder')) . '\' )">' . __('Confirm Email', 'profile-builder') . '</a>', wppb_curpageurl(), 'confirm', $item['ID']), 'resend' => sprintf('<a href="javascript:confirmECAction( \'%s\', \'%s\', \'%s\', \'' . addslashes(__('resend the activation link?', 'profile-builder')) . '\' )">' . __('Resend Activation Email', 'profile-builder') . '</a>', wppb_curpageurl(), 'resend', $item['ID'])); //Return the user row return sprintf('%1$s <strong>%2$s</strong> %3$s', $GRavatar, $item['username'], $this->row_actions($actions)); }
function wppb_front_end_login($atts) { extract(shortcode_atts(array('display' => true, 'redirect' => ''), $atts)); $wppb_generalSettings = get_option('wppb_general_settings'); if (!is_user_logged_in()) { // set up the form arguments $form_args = array('echo' => false, 'id_submit' => 'wppb-submit'); // maybe set up the redirect argument if (empty($redirect)) { $wppb_module_settings = get_option('wppb_module_settings'); if ($wppb_module_settings['wppb_customRedirect'] == 'show') { //check to see if the redirect location is not an empty string and is activated $login_redirect_settings = get_option('customRedirectSettings'); // set up the redirect argument to our redirect page if (trim($login_redirect_settings['afterLoginTarget']) != '' && $login_redirect_settings['afterLogin'] == 'yes') { $redirect_to = trim($login_redirect_settings['afterLoginTarget']); if (wppb_check_missing_http($redirect_to)) { $redirect_to = 'http://' . $redirect_to; } $form_args['redirect'] = $redirect_to; } } } else { $form_args['redirect'] = trim($redirect); } // change the label argument for username is login with email is enabled if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { $form_args['label_username'] = __('Email', 'profilebuilder'); } // initialize our form variable $login_form = ''; // display our login errors if (isset($_GET['loginerror']) || isset($_POST['loginerror'])) { $loginerror = isset($_GET['loginerror']) ? $_GET['loginerror'] : $_POST['loginerror']; $loginerror = '<p class="wppb-error">' . urldecode(base64_decode($loginerror)) . '</p><!-- .error -->'; if (isset($_GET['request_form_location'])) { if ($_GET['request_form_location'] == 'widget' && !in_the_loop()) { $login_form .= $loginerror; } elseif ($_GET['request_form_location'] == 'page' && in_the_loop()) { $login_form .= $loginerror; } } } // build our form $login_form .= '<div id="wppb-login-wrap" class="wppb-user-forms">'; $login_form .= wp_login_form($form_args); $login_form .= '</div>'; return $login_form; } else { $user_ID = get_current_user_id(); $wppb_user = get_userdata($user_ID); if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { $display_name = $wppb_user->user_email; } elseif ($wppb_user->display_name !== '') { $display_name = $wppb_user->user_login; } else { $display_name = $wppb_user->display_name; } $loged_in_message = '<p class="wppb-alert">' . sprintf(__('You are currently logged in as %1$s. %2$s', 'profilebuilder'), '<a href="' . ($authorPostsUrl = get_author_posts_url($wppb_user->ID) . '" title="' . $display_name . '">' . $display_name . '</a>'), '<a href="' . wp_logout_url($redirectTo = wppb_curpageurl()) . '" title="' . __('Log out of this account', 'profilebuilder') . '">' . __('Log out', 'profilebuilder') . ' »</a>') . '</p><!-- .alert-->'; return apply_filters('wppb_login_message', $loged_in_message, $wppb_user->ID, $display_name); } }
function wppb_front_end_login($atts) { $loginFilterArray = array(); ob_start(); global $wppb_login; $wppb_generalSettings = get_option('wppb_general_settings'); extract(shortcode_atts(array('display' => true, 'redirect' => '', 'submit' => 'page'), $atts)); echo '<div class="wppb_holder" id="wppb_login">'; if (is_user_logged_in()) { // Already logged in global $user_ID; $wppb_user = get_userdata($user_ID); if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { $display_name = $wppb_user->user_email; } elseif ($wppb_user->display_name !== '') { $display_name = $wppb_user->user_login; } else { $display_name = $wppb_user->display_name; } $loginFilterArray['loginMessage1'] = '<p class="alert">' . sprintf(__('You are currently logged in as %1$s. %2$s', 'profilebuilder'), '<a href="' . ($authorPostsUrl = get_author_posts_url($wppb_user->ID) . '" title="' . $display_name . '">' . $display_name . '</a>'), '<a href="' . wp_logout_url($redirectTo = wppb_curpageurl()) . '" title="' . __('Log out of this account', 'profilebuilder') . '">' . __('Log out', 'profilebuilder') . ' »</a>') . '</p><!-- .alert-->'; echo $loginFilterArray['loginMessage1'] = apply_filters('wppb_login_login_message1', $loginFilterArray['loginMessage1'], $wppb_user->ID, $display_name); } elseif (isset($wppb_login->ID)) { // Successful login if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { $display_name = $wppb_login->user_email; } elseif ($wppb_login->display_name !== '') { $display_name = $wppb_login->user_login; } else { $display_name = $wppb_login->display_name; } //$loginFilterArray['loginMessage2'] = '<p class="success">' . sprintf(__('You have successfully logged in as %1$s', 'profilebuilder'), '<a href="'.$authorPostsUrl = get_author_posts_url( $wppb_login->ID ).'" title="'.$display_name.'">'.$display_name.'</a>') . '</p><!-- .success-->'; $loginFilterArray['loginMessage2'] = '<p class="success">' . sprintf(__('Вы вошли как %1$s', 'profilebuilder'), '<a href="' . ($authorPostsUrl = get_author_posts_url($wppb_login->ID) . '" title="' . $display_name . '">' . $display_name . '</a>')) . '</p><!-- .success-->'; echo $loginFilterArray['loginMessage2'] = apply_filters('wppb_login_login_message2', $loginFilterArray['loginMessage2'], $wppb_login->ID, $display_name); if (isset($_POST['button']) && isset($_POST['formName'])) { if ($_POST['formName'] == 'login') { if ($_POST['button'] == 'page') { $permaLnk2 = wppb_curpageurl(); $wppb_addon_settings = get_option('wppb_addon_settings'); //fetch the descriptions array if ($wppb_addon_settings['wppb_customRedirect'] == 'show') { //check to see if the redirect location is not an empty string and is activated $customRedirectSettings = get_option('customRedirectSettings'); if (trim($customRedirectSettings['afterLoginTarget']) != '' && $customRedirectSettings['afterLogin'] == 'yes') { $permaLnk2 = trim($customRedirectSettings['afterLoginTarget']); if (wppb_check_missing_http($permaLnk2)) { $permaLnk2 = 'http://' . $permaLnk2; } } } $permaLnk2 = "/account/profile/"; //$loginFilterArray['redirectMessage'] = '<font id="messageTextColor">' . sprintf(__('You will soon be redirected automatically. If you see this page for more than 1 second, please click %1$s', 'profilebuilder'), '<a href="'.$permaLnk2.'">'. __('here', 'profilebuilder').'</a>.<meta http-equiv="Refresh" content="1;url='.$permaLnk2.'" />') . '</font><br/><br/>'; $loginFilterArray['redirectMessage'] = '<font id="messageTextColor">' . sprintf(__('В ближайшее время вы будете перенаправлены на другую страницу. Если прошло более 1 секунды, то нажмите на эту ссылку %1$s', 'profilebuilder'), '<a href="' . $permaLnk2 . '">' . __('here', 'profilebuilder') . '</a>.<meta http-equiv="Refresh" content="1;url=' . $permaLnk2 . '" />') . '</font><br/><br/>'; echo $loginFilterArray['redirectMessage'] = apply_filters('wppb_login_redirect_message', $loginFilterArray['redirectMessage'], $permaLnk2); } elseif ($_POST['button'] == 'widget') { $permaLnk2 = wppb_curpageurl(); if ($redirect != '') { $permaLnk2 = trim($redirect); } $loginFilterArray['widgetRedirectMessage'] = '<font id="messageTextColor">' . sprintf(__('You will soon be redirected automatically. If you see this page for more than 1 second, please click %1$s', 'profilebuilder'), '<a href="' . $permaLnk2 . '">' . __('here', 'profilebuilder') . '</a>.<meta http-equiv="Refresh" content="1;url=' . $permaLnk2 . '" />') . '</font><br/><br/>'; echo $loginFilterArray['widgetRedirectMessage'] = apply_filters('wppb_login_widget_redirect_message', $loginFilterArray['widgetRedirectMessage'], $permaLnk2); } } } } else { // Not logged in if (!empty($_POST['action']) && isset($_POST['formName'])) { if ($_POST['formName'] == 'login') { ?> <p class="error"> <?php if (trim($_POST['user-name']) == '') { if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { $loginFilterArray['emptyUsernameError'] = '<strong>' . __('ERROR:', 'profilebuilder') . '</strong> ' . __('The email field is empty', 'profilebuilder') . '.'; $loginFilterArray['emptyUsernameError'] = apply_filters('wppb_login_empty_email_as_username_error_message', $loginFilterArray['emptyUsernameError']); } else { $loginFilterArray['emptyUsernameError'] = '<strong>' . __('ERROR:', 'profilebuilder') . '</strong> ' . __('The username field is empty', 'profilebuilder') . '.'; $loginFilterArray['emptyUsernameError'] = apply_filters('wppb_login_empty_username_error_message', $loginFilterArray['emptyUsernameError']); } echo $loginFilterArray['emptyUsernameError']; } elseif (trim($_POST['password']) == '') { $loginFilterArray['emptyPasswordError'] = '<strong>' . __('ERROR:', 'profilebuilder') . '</strong> ' . __('The password field is empty', 'profilebuilder') . '.'; $loginFilterArray['emptyPasswordError'] = apply_filters('wppb_login_empty_password_error_message', $loginFilterArray['emptyPasswordError']); echo $loginFilterArray['emptyPasswordError']; } if (is_wp_error($wppb_login)) { $loginFilterArray['wpError'] = $wppb_login->get_error_message(); $loginFilterArray['wpError'] = apply_filters('wppb_login_wp_error_message', $loginFilterArray['wpError'], $wppb_login); echo $loginFilterArray['wpError']; } ?> </p><!-- .error --> <?php } } /* use this action hook to add extra content before the login form. */ do_action('wppb_before_login'); ?> <form action="<?php wppb_curpageurl(); ?> " method="post" class="sign-in" name="loginForm"> <?php if (isset($_POST['user-name'])) { $userName = esc_html($_POST['user-name']); } else { $userName = ''; } if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') { $loginWith = __('Email', 'profilebuilder'); } else { $loginWith = __('Username', 'profilebuilder'); } $loginFilterArray['loginUsername'] = '******' . $loginWith . '</label> <input type="text" name="user-name" id="user-name" class="text-input" value="' . $userName . '" /> </p><!-- .form-username -->'; $loginFilterArray['loginUsername'] = apply_filters('wppb_login_username', $loginFilterArray['loginUsername'], $userName); echo $loginFilterArray['loginUsername']; $loginFilterArray['loginPassword'] = '******' . __('Password', 'profilebuilder') . '</label> <input type="password" name="password" id="password" class="text-input" /> </p><!-- .form-password -->'; $loginFilterArray['loginPassword'] = apply_filters('wppb_login_password', $loginFilterArray['loginPassword']); echo $loginFilterArray['loginPassword']; ?> <p class="login-form-submit"> <input type="submit" name="submit" class="submit button" value="<?php _e('Log in', 'profilebuilder'); ?> " /> <?php $loginFilterArray['rememberMe'] = ' <input class="remember-me checkbox" name="remember-me" id="remember-me" type="checkbox" checked="checked" value="forever" /> <label for="remember-me">' . __('Remember me', 'profilebuilder') . '</label>'; $loginFilterArray['rememberMe'] = apply_filters('wppb_login_remember_me', $loginFilterArray['rememberMe']); echo $loginFilterArray['rememberMe']; ?> <input type="hidden" name="action" value="log-in" /> <input type="hidden" name="button" value="<?php echo $submit; ?> " /> <input type="hidden" name="formName" value="login" /> </p><!-- .form-submit --> <?php if ($display === true) { $siteURL = get_option('siteurl') . '/wp-login.php?action=lostpassword'; $siteURL = apply_filters('wppb_pre_login_url_filter', $siteURL); $loginFilterArray['loginURL'] = ' <p> <a href="' . $siteURL . '">' . __('Lost password?', 'profilebuilder') . '</a> </p>'; $loginFilterArray['loginURL'] = apply_filters('wppb_login_url', $loginFilterArray['loginURL'], $siteURL); echo $loginFilterArray['loginURL']; } wp_nonce_field('verify_true_login', 'login_nonce_field'); ?> </form><!-- .sign-in --> <?php } /* use this action hook to add extra content after the login form. */ do_action('wppb_after_login'); ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); $loginFilterArray = apply_filters('wppb_login', $loginFilterArray); return $output; }
/** * Notify user of signup success. * * Filter 'wppb_signup_user_notification_filter' to bypass this function or * replace it with your own notification behavior. * * Filter 'wppb_signup_user_notification_email' and * 'wppb_signup_user_notification_subject' to change the content * and subject line of the email sent to newly registered users. * * @param string $user The user's login name. * @param string $user_email The user's email address. * @param array $meta By default, an empty array. * @param string $key The activation key created in wppb_signup_user() * @return bool */ function wppb_signup_user_notification($user, $user_email, $key, $meta = '') { if (!apply_filters('wppb_signup_user_notification_filter', $user, $user_email, $key, $meta)) { return false; } // Send email with activation link. $admin_email = get_site_option('admin_email'); if ($admin_email == '') { $admin_email = 'support@' . $_SERVER['SERVER_NAME']; } //$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); //$from_name = apply_filters ('wppb_signup_user_notification_email_from_field', $from_name); //$message_headers = apply_filters ("wppb_signup_user_notification_from", "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"); // // ksk - Content-Type: multipart/alternative; boundary $EOF = "\r\n"; $from_name = 'Т3С'; //Письмо с вложением состоит из нескольких частей, которые разделяются разделителем // Генерируем разделитель $boundary = md5(uniqid(time())); //$message_headers = apply_filters ("wppb_signup_user_notification_from", "MIME-Version: 1.0;".$EOF."From: \"{$from_name}\" <{$admin_email}>".$EOF."Content-Type: multipart/mixed; boundary=$boundary".$EOF); $message_headers = "MIME-Version: 1.0;" . $EOF; $message_headers .= "From: {$from_name} <{$admin_email}>" . $EOF; //$message_headers .= "Content-Type: multipart/alternative; boundary=$boundary".$EOF; $message_headers .= "Content-Type: multipart/mixed; boundary=\"{$boundary}\"" . $EOF; $siteURL = wppb_curpageurl() . wppb_passed_arguments_check() . 'key=' . $key; //$subject = sprintf(apply_filters( 'wppb_signup_user_notification_subject', __( '[%1$s] Activate %2$s', 'profilebuilder'), $user, $user_email, $key, $meta ), $from_name, $user); //$message = sprintf(apply_filters( 'wppb_signup_user_notification_email', __( "To activate your user, please click the following link:\n\n%s%s%s\n\nAfter you activate, you will receive *another email* with your login.\n\n", "profilebuilder" ),$user, $user_email, $key, $meta), '<a href="'.$siteURL.'">', $siteURL, '</a>.'); // ksk // Текст письма содержится на странице, ID которой указан в параметре t3s_setting_signup_user_notification_page_id $subject = 'Подтвердите регистрацию на портале Т3С'; $page_id = get_option('t3s_setting_signup_user_notification_page_id'); $page_data = get_page($page_id); $page_content = apply_filters('the_content', $page_data->post_content); $user_meta = unserialize($meta); $fname1 = get_site_url() . '/wp-content/themes/twentytwelve/images/reg_mail_logo.png'; $fname2 = get_site_url() . '/wp-content/themes/twentytwelve/images/reg_mail_bottom.png'; $message = "--{$boundary}" . $EOF; $message .= 'Content-type: text/html; charset="' . get_option('blog_charset') . '"' . $EOF; //$message .= "Content-Transfer-Encoding: base64".$EOF; $message .= "Content-Transfer-Encoding: 8bit" . $EOF; $message .= $EOF; $message .= "<html>" . $EOF; $message .= "<head>" . $EOF; $message .= " <meta content=\"text/html; charset=" . get_option('blog_charset') . "\" http-equiv=\"Content-Type\">" . $EOF; $message .= "</head>" . $EOF; $message .= "<body>" . $EOF; $message .= str_replace('#t3s_biz_img_1#', $fname1, str_replace('#t3s_biz_img_2#', $fname2, str_replace('#url#', $siteURL, str_replace('#login#', $user, str_replace('#fio#', $user_meta['first_name'] . ' ' . $user_meta['last_name'], $page_content))))) . $EOF; $message .= "</body>" . $EOF; $message .= "</html>" . $EOF; // //wppb_mail( $user_email, $subject, $message, $from_name, '', $user, '', $user_email, 'register_w_email_confirmation', $siteURL, $meta ); // отправляем письмо $result = mail($user_email, $subject, $message, $message_headers); return $result; }
/** ************************************************************************ * Recommended. This is a custom column method and is responsible for what * is rendered in any column with a name/slug of 'username'. Every time the class * needs to render a column, it first looks for a method named * column_{$column_title} - if it exists, that method is run. If it doesn't * exist, column_default() is called instead. * * This example also illustrates how to implement rollover actions. Actions * should be an associative array formatted as 'slug'=>'link html' - and you * will need to generate the URLs yourself. You could even ensure the links * * * @see WP_List_Table::::single_row_columns() * @param array $item A singular item (one full row's worth of data) * @return string Text to be placed inside the column <td> **************************************************************************/ function column_username($item) { global $current_user; $GRavatar = get_avatar($item['email'], 32, ''); $user = get_user_by('email', $item['email']); $currentUser = wp_get_current_user(); $wppb_nonce = wp_create_nonce('_nonce_' . $current_user->ID . $user->ID); $edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(stripslashes($_SERVER['REQUEST_URI'])), get_edit_user_link($user->ID))); $actions['remove'] = sprintf('<a class=\'edit_view\' href="%s">' . __('View or Edit', 'profilebuilder') . '</a>', $edit_link); //Build row actions (approve/unapprove), but only for the users different from the currently logged in one if ($current_user->ID != $user->ID) { if (user_can($current_user->ID, 'delete_user')) { $actions['delete'] = sprintf('<a class=\'submitdelete\' href="javascript:confirmAUAction(\'%s\',\'%s\',\'%s\',\'%s\',\'' . __('delete this user?', 'profilebuilder') . '\')">' . __('Delete', 'profilebuilder') . '</a>', wppb_curpageurl(), 'delete', $user->ID, $wppb_nonce); } if (!wp_get_object_terms($user->ID, 'user_status')) { $actions['unapproved'] = sprintf('<a href="javascript:confirmAUAction(\'%s\',\'%s\',\'%s\',\'%s\',\'' . __('unapprove this user?', 'profilebuilder') . '\')">' . __('Unapprove', 'profilebuilder') . '</a>', wppb_curpageurl(), 'unapprove', $user->ID, $wppb_nonce); } else { $actions['approved'] = sprintf('<a href="javascript:confirmAUAction(\'%s\',\'%s\',\'%s\',\'%s\',\'' . __('approve this user?', 'profilebuilder') . '\')">' . __('Approve', 'profilebuilder') . '</a>', wppb_curpageurl(), 'approve', $user->ID, $wppb_nonce); } } //Return the user row return sprintf('%1$s <strong>%2$s</strong> %3$s', $GRavatar, '<a href="' . $edit_link . '">' . $item['username'] . '</a>', $this->row_actions($actions)); }
function wppb_form_content($message) { $field_check_errors = array(); if (isset($_REQUEST['action'])) { $field_check_errors = $this->wppb_test_required_form_values($_REQUEST); if (empty($field_check_errors)) { // we only have a $user_id on default registration (no email confirmation, no multisite) $user_id = $this->wppb_save_form_values($_REQUEST); if ('POST' == $_SERVER['REQUEST_METHOD'] && $_POST['action'] == $this->args['form_type']) { $form_message_tpl_start = apply_filters('wppb_form_message_tpl_start', '<p class="alert" id="wppb_form_success_message">'); $form_message_tpl_end = apply_filters('wppb_form_message_tpl_end', '</p>'); if ($this->args['form_type'] == 'register') { // ec = email confirmation setting // aa = admin approval setting $wppb_general_settings = get_option('wppb_general_settings', 'false'); if ($wppb_general_settings) { if (!empty($wppb_general_settings['emailConfirmation'])) { $wppb_email_confirmation = $wppb_general_settings['emailConfirmation']; } else { $wppb_email_confirmation = 'no'; } if (!empty($wppb_general_settings['adminApproval'])) { $wppb_admin_approval = $wppb_general_settings['adminApproval']; } else { $wppb_admin_approval = 'no'; } $account_management_settings = 'ec-' . $wppb_email_confirmation . '_' . 'aa-' . $wppb_admin_approval; } else { $account_management_settings = 'ec-no_aa-no'; } if (isset($_POST['username']) && trim($_POST['username']) != '') { $account_name = trim($_POST['username']); } elseif (isset($_POST['email']) && trim($_POST['email']) != '') { $account_name = trim($_POST['email']); } switch ($account_management_settings) { case 'ec-no_aa-no': $wppb_register_success_message = apply_filters('wppb_register_success_message', sprintf(__("The account %1s has been successfully created!", 'profilebuilder'), $account_name)); break; case 'ec-yes_aa-no': $wppb_register_success_message = apply_filters('wppb_register_success_message', sprintf(__("Before you can access your account %1s, you need to confirm your email address. Please check your inbox and click the activation link.", 'profilebuilder'), $account_name)); break; case 'ec-no_aa-yes': $wppb_register_success_message = apply_filters('wppb_register_success_message', sprintf(__("Before you can access your account %1s, an administrator has to approve it. You will be notified via email.", 'profilebuilder'), $account_name)); break; case 'ec-yes_aa-yes': $wppb_register_success_message = apply_filters('wppb_register_success_message', sprintf(__("Before you can access your account %1s, you need to confirm your email address. Please check your inbox and click the activation link.", 'profilebuilder'), $account_name)); break; } $redirect = apply_filters('wppb_register_redirect', $this->wppb_get_redirect()); echo $form_message_tpl_start . $wppb_register_success_message . $form_message_tpl_end . $redirect; //action hook after registration success do_action('wppb_register_success', $_REQUEST, $this->args['form_name'], $user_id); return; } elseif ($this->args['form_type'] == 'edit_profile') { $redirect = apply_filters('wppb_edit_profile_redirect', $this->wppb_get_redirect()); echo $form_message_tpl_start . apply_filters('wppb_edit_profile_success_message', __('Your profile has been successfully updated!', 'profilebuilder')) . $form_message_tpl_end . $redirect; //action hook after edit profile success do_action('wppb_edit_profile_success', $_REQUEST, $this->args['form_name'], $user_id); if (apply_filters('wppb_no_form_after_profile_update', false)) { return; } } } } else { echo $message . apply_filters('wppb_general_top_error_message', '<p id="wppb_general_top_error_message">' . __('There was an error in the submitted form', 'profilebuilder') . '</p>'); } } else { echo $message; } // use this action hook to add extra content before the register form do_action('wppb_before_' . $this->args['form_type'] . '_fields'); ?> <form enctype="multipart/form-data" method="post" id="<?php if ($this->args['form_type'] == 'register') { echo 'wppb-register-user'; } else { if ($this->args['form_type'] == 'edit_profile') { echo 'wppb-edit-user'; } } ?> " class="wppb-user-forms" action="<?php echo wppb_curpageurl(); ?> "> <?php echo apply_filters('wppb_before_form_fields', '<ul>'); $this->wppb_output_form_fields($_REQUEST, $field_check_errors); echo apply_filters('wppb_after_form_fields', '</ul>'); echo apply_filters('wppb_before_send_credentials_checkbox', '<ul>'); $this->wppb_add_send_credentials_checkbox($_REQUEST, $this->args['form_type']); echo apply_filters('wppb_after_send_credentials_checkbox', '</ul>'); ?> <p class="form-submit"> <?php if ($this->args['form_type'] == 'register') { $button_name = current_user_can('create_user') ? __('Add User', 'profilebuilder') : __('Register', 'profilebuilder'); } elseif ($this->args['form_type'] == 'edit_profile') { $button_name = __('Update', 'profilebuilder'); } ?> <input name="<?php echo $this->args['form_type']; ?> " type="submit" id="<?php echo $this->args['form_type']; ?> " class="submit button" value="<?php echo apply_filters('wppb_' . $this->args['form_type'] . '_button_name', $button_name); ?> " /> <input name="action" type="hidden" id="action" value="<?php echo $this->args['form_type']; ?> " /> <input name="form_name" type="hidden" id="form_name" value="<?php echo $this->args['form_name']; ?> " /> </p><!-- .form-submit --> <?php wp_nonce_field('verify_form_submission', $this->args['form_type'] . '_nonce_field'); ?> </form> <?php // use this action hook to add extra content after the register form do_action('wppb_after_' . $this->args['form_type'] . '_fields'); }
function wppb_front_end_login() { $loginFilterArray = array(); ob_start(); global $wppb_login; echo '<div class="wppb_holder" id="wppb_login">'; if (is_user_logged_in()) { // Already logged in global $user_ID; $wppb_user = get_userdata($user_ID); if ($wppb_user->display_name == '') { $wppb_user->display_name = $wppb_user->user_login; } ?> <?php $loginFilterArray['loginMessage1'] = ' <p class="alert">' . __('You are currently logged in as', 'profilebuilder') . ' <a href="' . ($authorPostsUrl = get_author_posts_url($wppb_user->ID) . '" title="' . $wppb_user->display_name . '">' . $wppb_user->display_name . '</a>. <a href="' . wp_logout_url(get_permalink()) . '" title="' . __('Log out of this account', 'profilebuilder') . '">' . __('Log out', 'profilebuilder') . ' »</a> </p><!-- .alert-->'); $loginFilterArray['loginMessage1'] = apply_filters('wppb_login_login_message1', $loginFilterArray['loginMessage1'], $wppb_user->ID, $wppb_user->display_name); echo $loginFilterArray['loginMessage1']; ?> <?php } elseif ($wppb_login->ID) { // Successful login ?> <?php if ($wppb_login->display_name == '') { $wppb_login->display_name = $wppb_login->user_login; } ?> <?php $loginFilterArray['loginMessage2'] = ' <p class="success">' . __('You have successfully logged in as', 'profilebuilder') . ' <a href="' . ($authorPostsUrl = get_author_posts_url($wppb_login->ID) . '" title="' . $wppb_login->display_name . '">' . $wppb_login->display_name . '</a>. </p><!-- .success-->'); $loginFilterArray['loginMessage2'] = apply_filters('wppb_login_login_message2', $loginFilterArray['loginMessage2'], $wppb_login->ID, $wppb_user->display_name); echo $loginFilterArray['loginMessage2']; ?> <?php $permaLnk2 = get_permalink(); $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_addon_settings = get_option('wppb_addon_settings'); //fetch the descriptions array if ($wppb_addon_settings['wppb_customRedirect'] == 'show') { //check to see if the redirect location is not an empty string and is activated $customRedirectSettings = get_option('customRedirectSettings'); if (trim($customRedirectSettings['afterLoginTarget']) != '' && $customRedirectSettings['afterLogin'] == 'yes') { $permaLnk2 = trim($customRedirectSettings['afterLoginTarget']); $findHttp = strpos($permaLnk2, 'http'); if ($findHttp === false) { $permaLnk2 = 'http://' . $permaLnk2; } } } } $loginFilterArray['redirectMessage'] = ' <font id="messageTextColor">' . __('You will soon be redirected automatically. If you see this page for more than 1 second, please click', 'profilebuilder') . ' <a href="' . $permaLnk2 . '">' . __('here', 'profilebuilder') . '</a>.<meta http-equiv="Refresh" content="1;url=' . $permaLnk2 . '" /></font><br/><br/>'; $loginFilterArray['redirectMessage'] = apply_filters('wppb_login_redirect_message', $loginFilterArray['redirectMessage'], $permaLnk2); echo $loginFilterArray['redirectMessage']; ?> <?php } else { // Not logged in ?> <?php if (!empty($_POST['action'])) { ?> <p class="error"> <?php if (trim($_POST['user-name']) == '') { $loginFilterArray['emptyUsernameError'] = '<strong>' . __('ERROR:', 'profilebuilder') . '</strong> ' . __('The username field is empty', 'profilebuilder') . '.'; $loginFilterArray['emptyUsernameError'] = apply_filters('wppb_login_empty_username_error_message', $loginFilterArray['emptyUsernameError']); echo $loginFilterArray['emptyUsernameError']; } if (is_wp_error($wppb_login)) { $loginFilterArray['wpError'] = $wppb_login->get_error_message(); $loginFilterArray['wpError'] = apply_filters('wppb_login_wp_error_message', $loginFilterArray['wpError'], $wppb_login); echo $loginFilterArray['wpError']; } ?> </p><!-- .error --> <?php } ?> <?php /* use this action hook to add extra content before the login form. */ ?> <?php do_action('wppb_before_login'); ?> <form action="<?php wppb_curpageurl(); ?> " method="post" class="sign-in"> <?php if (isset($_POST['user-name'])) { $userName = esc_html($_POST['user-name']); } else { $userName = ''; } $loginFilterArray['loginUsername'] = '******' . __('Username', 'profilebuilder') . '</label> <input type="text" name="user-name" id="user-name" class="text-input" value="' . $userName . '" /> </p><!-- .form-username -->'; $loginFilterArray['loginUsername'] = apply_filters('wppb_login_username', $loginFilterArray['loginUsername'], $userName); echo $loginFilterArray['loginUsername']; $loginFilterArray['loginPassword'] = '******' . __('Password', 'profilebuilder') . '</label> <input type="password" name="password" id="password" class="text-input" /> </p><!-- .form-password -->'; $loginFilterArray['loginPassword'] = apply_filters('wppb_login_password', $loginFilterArray['loginPassword']); echo $loginFilterArray['loginPassword']; ?> <p class="login-form-submit"> <input type="submit" name="submit" class="submit button" value="<?php _e('Log in', 'profilebuilder'); ?> " /> <?php $loginFilterArray['rememberMe'] = ' <input class="remember-me checkbox" name="remember-me" id="remember-me" type="checkbox" checked="checked" value="forever" /> <label for="remember-me">' . __('Remember me', 'profilebuilder') . '</label>'; $loginFilterArray['rememberMe'] = apply_filters('wppb_login_remember_me', $loginFilterArray['rememberMe']); echo $loginFilterArray['rememberMe']; ?> <input type="hidden" name="action" value="log-in" /> </p><!-- .form-submit --> <?php $siteURL = get_option('siteurl') . '/wp-login.php?action=lostpassword'; $loginFilterArray['loginURL'] = ' <p> <a href="' . $siteURL . '">' . __('Lost password?', 'profilebuilder') . '</a> </p>'; $loginFilterArray['loginURL'] = apply_filters('wppb_login_url', $loginFilterArray['loginURL'], $siteURL); echo $loginFilterArray['loginURL']; ?> <?php wp_nonce_field('verify_true_login', 'login_nonce_field'); ?> </form><!-- .sign-in --> <?php } ?> <?php /* use this action hook to add extra content after the login form. */ ?> <?php do_action('wppb_after_login'); ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); $loginFilterArray = apply_filters('wppb_login', $loginFilterArray); return $output; }
/** * Notify user of signup success. * * Filter 'wppb_signup_user_notification_filter' to bypass this function or * replace it with your own notification behavior. * * Filter 'wppb_signup_user_notification_email' and * 'wppb_signup_user_notification_subject' to change the content * and subject line of the email sent to newly registered users. * * @param string $user The user's login name. * @param string $user_email The user's email address. * @param array $meta By default, an empty array. * @param string $key The activation key created in wppb_signup_user() * @return bool */ function wppb_signup_user_notification($user, $user_email, $key, $meta = '') { if (!apply_filters('wppb_signup_user_notification_filter', $user, $user_email, $key, $meta)) { return false; } // Send email with activation link. $admin_email = get_site_option('admin_email'); if ($admin_email == '') { $admin_email = 'support@' . $_SERVER['SERVER_NAME']; } $from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name')); $from_name = apply_filters('wppb_signup_user_notification_email_from_field', $from_name); $message_headers = apply_filters("wppb_signup_user_notification_from", "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"); $siteURL = wppb_curpageurl() . wppb_passed_arguments_check() . 'key=' . $key; $subject = sprintf(apply_filters('wppb_signup_user_notification_subject', __('[%1$s] Activate %2$s', 'profilebuilder'), $user, $user_email, $key, $meta), $from_name, $user); $message = sprintf(apply_filters('wppb_signup_user_notification_email', __("To activate your user, please click the following link:\n\n%s%s%s\n\nAfter you activate, you will receive *another email* with your login.\n\n", "profilebuilder"), $user, $user_email, $key, $meta), '<a href="' . $siteURL . '">', $siteURL, '</a>.'); wppb_mail($user_email, $subject, $message, $from_name, '', $user, '', $user_email, 'register_w_email_confirmation', $siteURL, $meta); return true; }
function wppb_front_end_password_recovery() { $recoverPasswordFilterArray = array(); $message = ''; $messageNo = ''; $message2 = ''; $messageNo2 = ''; global $wpdb; $linkLoginName = ''; $linkKey = ''; ob_start(); /* If the user entered an email/username, process the request */ if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'recover_password' && wp_verify_nonce($_POST['password_recovery_nonce_field'], 'verify_true_password_recovery')) { $postedData = esc_html($_POST['username_email']); //we get the raw data //check to see if it's an e-mail (and if this is valid/present in the database) or is a username if (is_email($postedData)) { if (email_exists($postedData)) { $retVal = wppb_check_for_unapproved_user($postedData, 'user_email'); if ($retVal[0] != '') { $message = $retVal[0]; $messageNo = $retVal[1]; } else { $recoverPasswordFilterArray['sentMessage1'] = sprintf(__('A password reset email has been sent to %1$s.<br/>Following the link sent in the email address will reset the password.', 'profilebuilder'), $postedData); $recoverPasswordFilterArray['sentMessage1'] = apply_filters('wppb_recover_password_sent_message1', $recoverPasswordFilterArray['sentMessage1'], $postedData); $message = $recoverPasswordFilterArray['sentMessage1']; $messageNo = '1'; //verify e-mail validity $query = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_email= %s", $postedData)); $requestedUserID = $query[0]->ID; $requestedUserLogin = $query[0]->user_login; $requestedUserEmail = $query[0]->user_email; //search if there is already an activation key present, if not create one $key = wppb_retrieve_activation_key($requestedUserLogin); //send primary email message $recoverPasswordFilterArray['userMailMessage1'] = sprintf(__('Someone requested that the password be reset for the following account: <b>%1$s</b><br/>If this was a mistake, just ignore this email and nothing will happen.<br/>To reset your password, visit the following link:%2$s', 'profilebuilder'), $requestedUserLogin, '<a href="' . add_query_arg(array('loginName' => $requestedUserLogin, 'key' => $key), wppb_curpageurl()) . '">' . add_query_arg(array('loginName' => $requestedUserLogin, 'key' => $key), wppb_curpageurl()) . '</a>'); $recoverPasswordFilterArray['userMailMessage1'] = apply_filters('wppb_recover_password_message_content_sent_to_user1', $recoverPasswordFilterArray['userMailMessage1'], $requestedUserID, $requestedUserLogin); $recoverPasswordFilterArray['userMailMessageTitle1'] = sprintf(__('Password Reset from "%1$s"', 'profilebuilder'), $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES)); $recoverPasswordFilterArray['userMailMessageTitle1'] = apply_filters('wppb_recover_password_message_title_sent_to_user1', $recoverPasswordFilterArray['userMailMessageTitle1']); //we add this filter to enable html encoding add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); //send mail to the user notifying him of the reset request if (trim($recoverPasswordFilterArray['userMailMessageTitle1']) != '') { $sent = wp_mail($requestedUserEmail, $recoverPasswordFilterArray['userMailMessageTitle1'], $recoverPasswordFilterArray['userMailMessage1']); if ($sent === false) { $recoverPasswordFilterArray['sentMessageCouldntSendMessage'] = '<b>' . __('ERROR', 'profilebuilder') . ': </b>' . sprintf(__('There was an error while trying to send the activation link to %1$s!', 'profilebuilder'), $postedData); $recoverPasswordFilterArray['sentMessageCouldntSendMessage'] = apply_filters('wppb_recover_password_sent_message_error_sending', $recoverPasswordFilterArray['sentMessageCouldntSendMessage']); $messageNo = '5'; $message = $recoverPasswordFilterArray['sentMessageCouldntSendMessage']; } } } } elseif (!email_exists($postedData)) { $recoverPasswordFilterArray['sentMessage2'] = __('The email address entered wasn\'t found in the database!', 'profilebuilder') . '<br/>' . __('Please check that you entered the correct email address.', 'profilebuilder'); $recoverPasswordFilterArray['sentMessage2'] = apply_filters('wppb_recover_password_sent_message2', $recoverPasswordFilterArray['sentMessage2']); $messageNo = '2'; $message = $recoverPasswordFilterArray['sentMessage2']; } } elseif (!is_email($postedData)) { if (username_exists($postedData)) { $retVal = wppb_check_for_unapproved_user($postedData, 'user_login'); if ($retVal[0] != '') { $message = $retVal[0]; $messageNo = $retVal[1]; } else { $recoverPasswordFilterArray['sentMessage3'] = sprintf(__('A password reset email has been sent to %1$s.<br/>Following the link sent in the email address will reset the password.', 'profilebuilder'), $postedData); $recoverPasswordFilterArray['sentMessage3'] = apply_filters('wppb_recover_password_sent_message3', $recoverPasswordFilterArray['sentMessage3']); $messageNo = '3'; $message = $recoverPasswordFilterArray['sentMessage3']; //verify username validity $query = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_login= %s", $postedData)); $requestedUserID = $query[0]->ID; $requestedUserLogin = $query[0]->user_login; $requestedUserEmail = $query[0]->user_email; //search if there is already an activation key present, if not create one $key = wppb_retrieve_activation_key($requestedUserLogin); //send primary email message $recoverPasswordFilterArray['userMailMessage1'] = sprintf(__('Someone requested that the password be reset for the following account: <b>%1$s</b><br/>If this was a mistake, just ignore this email and nothing will happen.<br/>To reset your password, visit the following link:%2$s', 'profilebuilder'), $requestedUserLogin, '<a href="' . add_query_arg(array('loginName' => $requestedUserLogin, 'key' => $key), wppb_curpageurl()) . '">' . add_query_arg(array('loginName' => $requestedUserLogin, 'key' => $key), wppb_curpageurl()) . '</a>'); $recoverPasswordFilterArray['userMailMessage1'] = apply_filters('wppb_recover_password_message_content_sent_to_user1', $recoverPasswordFilterArray['userMailMessage1'], $requestedUserID, $requestedUserLogin); $recoverPasswordFilterArray['userMailMessageTitle1'] = sprintf(__('Password Reset from "%1$s"', 'profilebuilder'), $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES)); $recoverPasswordFilterArray['userMailMessageTitle1'] = apply_filters('wppb_recover_password_message_title_sent_to_user1', $recoverPasswordFilterArray['userMailMessageTitle1']); //we add this filter to enable html encoding add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); //send mail to the user notifying him of the reset request if (trim($recoverPasswordFilterArray['userMailMessageTitle1']) != '') { $sent = wp_mail($requestedUserEmail, $recoverPasswordFilterArray['userMailMessageTitle1'], $recoverPasswordFilterArray['userMailMessage1']); if ($sent === false) { $recoverPasswordFilterArray['sentMessageCouldntSendMessage'] = '<b>' . __('ERROR', 'profilebuilder') . ': </b>' . __('There was an error while trying to send the activation link to ', 'profilebuilder') . $postedData . '!'; $recoverPasswordFilterArray['sentMessageCouldntSendMessage'] = apply_filters('wppb_recover_password_sent_message_error_sending', $recoverPasswordFilterArray['sentMessageCouldntSendMessage']); $messageNo = '5'; $message = $recoverPasswordFilterArray['sentMessageCouldntSendMessage']; } } } } elseif (!username_exists($postedData)) { $recoverPasswordFilterArray['sentMessage4'] = __('The username entered wasn\'t found in the database!', 'profilebuilder') . '<br/>' . __('Please check that you entered the correct username.', 'profilebuilder'); $recoverPasswordFilterArray['sentMessage4'] = apply_filters('wppb_recover_password_sent_message4', $recoverPasswordFilterArray['sentMessage4']); $messageNo = '4'; $message = $recoverPasswordFilterArray['sentMessage4']; } } } elseif ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action2']) && $_POST['action2'] == 'recover_password2' && wp_verify_nonce($_POST['password_recovery_nonce_field2'], 'verify_true_password_recovery2_' . $_POST['userData'])) { if ($_POST['passw1'] == $_POST['passw2'] && (!empty($_POST['passw1']) && !empty($_POST['passw2']))) { $message2 = __('Your password has been successfully changed!', 'profilebuilder'); $messageNo2 = '1'; $userID = esc_html($_POST['userData']); $new_pass = $_POST['passw1']; //update the new password and delete the key do_action('wppb_password_reset', $userID, $new_pass); wp_set_password($new_pass, $userID); $user_info = get_userdata($userID); //send secondary mail to the user containing the username and the new password $recoverPasswordFilterArray['userMailMessage2'] = sprintf(__('You have successfully reset your password to: %1$s', 'profilebuilder'), $new_pass); $recoverPasswordFilterArray['userMailMessage2'] = apply_filters('wppb_recover_password_message_content_sent_to_user2', $recoverPasswordFilterArray['userMailMessage2'], $loginName); $recoverPasswordFilterArray['userMailMessageTitle2'] = sprintf(__('Password Successfully Reset for %1$s on "%2$s"', 'profilebuilder'), $user_info->user_login, $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES)); $recoverPasswordFilterArray['userMailMessageTitle2'] = apply_filters('wppb_recover_password_message_title_sent_to_user2', $recoverPasswordFilterArray['userMailMessageTitle2']); //we add this filter to enable html encoding add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); //send mail to the user notifying him of the reset request if (trim($recoverPasswordFilterArray['userMailMessageTitle2']) != '') { wp_mail($user_info->user_email, $recoverPasswordFilterArray['userMailMessageTitle2'], $recoverPasswordFilterArray['userMailMessage2']); } //send email to admin $recoverPasswordFilterArray['adminMailMessage'] = sprintf(__('%1$s has requested a password change via the password reset feature.<br/>His/her new password is:%2$s', 'profilebuilder'), $user_info->user_login, $_POST['passw1']); $recoverPasswordFilterArray['adminMailMessage'] = apply_filters('wppb_recover_password_message_content_sent_to_admin', $recoverPasswordFilterArray['adminMailMessage']); $recoverPasswordFilterArray['adminMailMessageTitle'] = sprintf(__('Password Successfully Reset for %1$s on "%2$s"', 'profilebuilder'), $user_info->user_login, $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES)); $recoverPasswordFilterArray['adminMailMessageTitle'] = apply_filters('wppb_recover_password_message_title_sent_to_admin', $recoverPasswordFilterArray['adminMailMessageTitle']); //we disable the feature to send the admin a notification mail but can be still used using filters $recoverPasswordFilterArray['adminMailMessageTitle'] = ''; $recoverPasswordFilterArray['adminMailMessageTitle'] = apply_filters('wppb_recover_password_message_title_sent_to_admin', $recoverPasswordFilterArray['adminMailMessageTitle']); //we add this filter to enable html encoding add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); //send mail to the admin notifying him of of a user with a password reset request if (trim($recoverPasswordFilterArray['adminMailMessageTitle']) != '') { wp_mail(get_option('admin_email'), $recoverPasswordFilterArray['adminMailMessageTitle'], $recoverPasswordFilterArray['adminMailMessage']); } } else { $message2 = __('The entered passwords don\'t match!', 'profilebuilder'); $messageNo2 = '2'; } } ?> <div class="wppb_holder" id="wppb_recover_password"> <?php /* use this action hook to add extra content before the password recovery form. */ do_action('wppb_before_recover_password_fields'); //this is the part that handles the actual recovery if (isset($_GET['submitted']) && isset($_GET['loginName']) && isset($_GET['key'])) { //get the login name and key and verify if they match the ones in the database $key = preg_replace('/[^a-z0-9]/i', '', $_GET['key']); $login = $_GET['loginName']; $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_activation_key = %s AND user_login = %s", $key, $login)); if (!empty($user)) { //check if the "finalAction" variable is not in the address bar, if it is, don't display the form anymore if (isset($_GET['finalAction']) && $_GET['finalAction'] == 'yes') { if ($messageNo2 == '2') { $recoverPasswordFilterArray['passwordChangedMessage2'] = '<p class="error">' . $message2 . '</p><!-- .error -->'; $recoverPasswordFilterArray['passwordChangedMessage2'] = apply_filters('wppb_recover_password_password_changed_message2', $recoverPasswordFilterArray['passwordChangedMessage2'], $message2); echo $recoverPasswordFilterArray['passwordChangedMessage2']; ?> <form enctype="multipart/form-data" method="post" id="recover_password2" class="user-forms" action="<?php echo add_query_arg('finalAction', 'yes', wppb_curpageurl()); ?> "> <?php $recoverPasswordFilterArray['inputPassword'] = '******' . __('Password', 'profilebuilder') . '</label> <input class="password" name="passw1" type="password" id="passw1" value="" /> </p><!-- .passw1 --> <input type="hidden" name="userData" value="' . $user->ID . '"/> <p class="passw2"> <label for="passw2">' . __('Repeat Password', 'profilebuilder') . '</label> <input class="password" name="passw2" type="password" id="passw2" value="" /> </p><!-- .passw2 -->'; $recoverPasswordFilterArray['inputPassword'] = apply_filters('wppb_recover_password_input_filter1', $recoverPasswordFilterArray['inputPassword'], $_POST['passw1'], $_POST['passw2'], $user->ID); echo $recoverPasswordFilterArray['inputPassword']; ?> <p class="form-submit"> <?php $button_name = __('Reset Password', 'profilebuilder'); ?> <input name="recover_password2" type="submit" id="recover_password2" class="submit button" value="<?php echo apply_filters('wppb_recover_password_button_name1', $button_name); ?> " /> <input name="action2" type="hidden" id="action2" value="recover_password2" /> </p><!-- .form-submit --> <?php wp_nonce_field('verify_true_password_recovery2_' . $user->ID, 'password_recovery_nonce_field2'); ?> </form><!-- #recover_password --> <?php } elseif ($messageNo2 == '1') { $recoverPasswordFilterArray['passwordChangedMessage1'] = '<p class="success">' . $message2 . '</p><!-- .success -->'; $recoverPasswordFilterArray['passwordChangedMessage1'] = apply_filters('wppb_recover_password_password_changed_message1', $recoverPasswordFilterArray['passwordChangedMessage1'], $message2); echo $recoverPasswordFilterArray['passwordChangedMessage1']; } } else { ?> <form enctype="multipart/form-data" method="post" id="recover_password2" class="user-forms" action="<?php echo add_query_arg('finalAction', 'yes', wppb_curpageurl()); ?> "> <?php $recoverPasswordFilterArray['inputPassword'] = '******' . __('Password', 'profilebuilder') . '</label> <input class="password" name="passw1" type="password" id="passw1" value="" /> </p><!-- .passw1 --> <input type="hidden" name="userData" value="' . $user->ID . '"/> <p class="passw2"> <label for="passw2">' . __('Repeat Password', 'profilebuilder') . '</label> <input class="password" name="passw2" type="password" id="passw2" value="" /> </p><!-- .passw2 -->'; $recoverPasswordFilterArray['inputPassword'] = apply_filters('wppb_recover_password_input_filter2', $recoverPasswordFilterArray['inputPassword'], $_POST['passw1'], $_POST['passw2'], $user->ID); echo $recoverPasswordFilterArray['inputPassword']; ?> <p class="form-submit"> <?php $button_name = __('Reset Password', 'profilebuilder'); ?> <input name="recover_password2" type="submit" id="recover_password2" class="submit button" value="<?php echo apply_filters('wppb_recover_password_button_name2', $button_name); ?> " /> <input name="action2" type="hidden" id="action2" value="recover_password2" /> </p><!-- .form-submit --> <?php wp_nonce_field('verify_true_password_recovery2_' . $user->ID, 'password_recovery_nonce_field2'); ?> </form><!-- #recover_password --> <?php } } else { if ($messageNo2 == '1') { $recoverPasswordFilterArray['passwordChangedMessage1'] = '<p class="success">' . $message2 . '</p><!-- .success -->'; $recoverPasswordFilterArray['passwordChangedMessage1'] = apply_filters('wppb_recover_password_password_changed_message1', $recoverPasswordFilterArray['passwordChangedMessage1'], $message2); echo $recoverPasswordFilterArray['passwordChangedMessage1']; } elseif ($messageNo2 == '2') { $recoverPasswordFilterArray['passwordChangedMessage2'] = '<p class="error">' . $message2 . '</p><!-- .error -->'; $recoverPasswordFilterArray['passwordChangedMessage2'] = apply_filters('wppb_recover_password_password_changed_message2', $recoverPasswordFilterArray['passwordChangedMessage2'], $message2); echo $recoverPasswordFilterArray['passwordChangedMessage2']; } else { $recoverPasswordFilterArray['invalidKeyMessage'] = '<p class="warning"><b>' . __('ERROR:', 'profilebuilder') . '</b> ' . __('Invalid key!', 'profilebuilder') . '</p><!-- .warning -->'; echo $recoverPasswordFilterArray['invalidKeyMessage'] = apply_filters('wppb_recover_password_invalid_key_message', $recoverPasswordFilterArray['invalidKeyMessage']); } } } else { //display error message and the form if ($messageNo == '' || $messageNo == '2' || $messageNo == '4') { $recoverPasswordFilterArray['messageDisplay1'] = ' <p class="warning">' . $message . '</p><!-- .warning -->'; $recoverPasswordFilterArray['messageDisplay1'] = apply_filters('wppb_recover_password_displayed_message1', $recoverPasswordFilterArray['messageDisplay1']); echo $recoverPasswordFilterArray['messageDisplay1']; echo '<form enctype="multipart/form-data" method="post" id="recover_password" class="user-forms" action="' . add_query_arg('submitted', 'yes', wppb_curpageurl()) . '">'; $recoverPasswordFilterArray['notification'] = __('Please enter your username or email address.', 'profilebuilder') . '<br/>' . __('You will receive a link to create a new password via email.', 'profilebuilder') . '<br/><br/>'; echo $recoverPasswordFilterArray['notification'] = apply_filters('wppb_recover_password_message1', $recoverPasswordFilterArray['notification']); $username_email = ''; if (isset($_POST['username_email'])) { $username_email = esc_attr($_POST['username_email']); } $recoverPasswordFilterArray['input'] = ' <p class="username_email"> <label for="username_email">' . __('Username or E-mail', 'profilebuilder') . '</label> <input class="text-input" name="username_email" type="text" id="username_email" value="' . $username_email . '" /> </p><!-- .username_email -->'; $recoverPasswordFilterArray['input'] = apply_filters('wppb_recover_password_input_filter2', $recoverPasswordFilterArray['input'], $username_email); echo $recoverPasswordFilterArray['input']; ?> <p class="form-submit"> <?php $button_name = __('Get New Password', 'profilebuilder'); ?> <input name="recover_password" type="submit" id="recover_password" class="submit button" value="<?php echo apply_filters('wppb_recover_password_button_name3', $button_name); ?> " /> <input name="action" type="hidden" id="action" value="recover_password" /> </p><!-- .form-submit --> <?php wp_nonce_field('verify_true_password_recovery', 'password_recovery_nonce_field'); ?> </form><!-- #recover_password --> <?php } elseif ($messageNo == '5' || $messageNo == '6') { $recoverPasswordFilterArray['messageDisplay1'] = ' <p class="warning">' . $message . '</p><!-- .warning -->'; $recoverPasswordFilterArray['messageDisplay1'] = apply_filters('wppb_recover_password_displayed_message1', $recoverPasswordFilterArray['messageDisplay1']); echo $recoverPasswordFilterArray['messageDisplay1']; } else { //display success message $recoverPasswordFilterArray['messageDisplay2'] = ' <p class="success">' . $message . '</p><!-- .success -->'; $recoverPasswordFilterArray['messageDisplay2'] = apply_filters('wppb_recover_password_displayed_message2', $recoverPasswordFilterArray['messageDisplay2']); echo $recoverPasswordFilterArray['messageDisplay2']; } } /* use this action hook to add extra content after the password recovery form. */ do_action('wppb_after_recover_password_fields'); ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); $recoverPasswordFilterArray = apply_filters('wppb_recover_password', $recoverPasswordFilterArray); return $output; }