function edit_userdata()
{
    global $current_user;
    get_currentuserinfo();
    $form = new Edit_form($current_user);
    $profile_fields_data = "";
    $profile_fields_data .= '<div class="pieregProfileWrapper pieregWrapper">
	<form enctype="multipart/form-data" id="pie_regiser_form" method="post" action="' . $_SERVER['REQUEST_URI'] . '">
	<ul id="pie_register">';
    $output = $form->editProfile($current_user);
    $profile_fields_data .= $output;
    $profile_fields_data .= '</ul>
	</form></div>';
    return $profile_fields_data;
}
Beispiel #2
0
 function showProfile()
 {
     $this->piereg_ssl_template_redirect();
     global $current_user, $pie_success, $pie_error, $pie_error_msg, $pie_suucess_msg;
     if (is_user_logged_in()) {
         get_currentuserinfo();
         if (isset($_GET['edit_user']) && $_GET['edit_user'] == "1") {
             $form = new Edit_form($current_user);
             if (isset($_POST['pie_submit_update'])) {
                 $form->error = "";
                 $errors = new WP_Error();
                 $errors = $form->validateRegistration($errors);
                 if (sizeof($errors->errors) > 0) {
                     foreach ($errors->errors as $err) {
                         $form->error .= $err[0] . "<br />";
                     }
                 } else {
                     $user_data = array('ID' => $current_user->ID);
                     if (isset($_POST['url'])) {
                         $user_data["user_url"] = $_POST['url'];
                         $form->pie_success = 1;
                     }
                     if ($current_user->data->email != $_POST['e_mail']) {
                         $user_data["user_email"] = $_POST['e_mail'];
                         $form->pie_success = 1;
                     }
                     /*
                      *	Modefy since 2.0.15
                      */
                     if (wp_check_password($_POST['old_password'], $current_user->data->user_pass, $current_user->ID) && !empty($_POST['password']) && $_POST['password'] == $_POST['confirm_password']) {
                         $user_data["user_pass"] = $_POST['password'];
                         $form->pie_success = 1;
                     }
                     $id = wp_update_user($user_data);
                     $form->UpdateUser();
                 }
             }
             $output = '';
             if ($form->pie_success) {
                 $output .= '<div class="alert alert-success"><p class="piereg_message">' . $form->pie_success_msg . '</p></div>';
             } elseif ($form->error != "") {
                 $output .= '<div class="alert alert-danger"><p class="piereg_login_error">' . $form->error . '</p></div>';
             }
             if (isset($_POST['success']) && $_POST['success'] != "") {
                 $output .= '<p class="piereg_message">' . apply_filters('piereg_messages', __($_POST['success'], "piereg")) . '</p>';
             }
             if (isset($_POST['error']) && $_POST['error'] != "") {
                 $output .= '<p class="piereg_login_error">' . apply_filters('piereg_messages', __($_POST['error'], "piereg")) . '</p>';
             }
             if (isset($_GET['pr_msg'], $_GET['type']) && !empty($_GET['pr_msg']) && $_GET['type'] == "success") {
                 $output .= '<p class="piereg_message">' . apply_filters('piereg_messages', base64_decode($_GET['pr_msg'])) . '</p>';
             } elseif (isset($_GET['pr_msg'], $_GET['type']) && !empty($_GET['pr_msg']) && $_GET['type'] == "error") {
                 $output .= '<p class="piereg_login_error">' . apply_filters('piereg_messages', base64_decode($_GET['pr_msg'])) . '</p>';
             }
             require_once $this->plugin_dir . "/edit_form.php";
             $output .= edit_userdata();
             return $output;
         } else {
             $profile_front = new Profile_front($current_user);
             $profile_form_data = $profile_front->print_user_profile();
             return $profile_form_data;
         }
     } else {
         return __('Please', 'piereg') . ' <a href="' . wp_login_url($this->get_current_permalink()) . '">' . __('login', 'piereg') . '</a> ' . __('to see your profile', 'piereg');
     }
 }