edit.php 6.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. $auth = SwpmAuth::get_instance();
  3. $user_data = (array) $auth->userData;
  4. $user_data['membership_level_alias'] = $auth->get('alias');
  5. extract($user_data, EXTR_SKIP);
  6. $settings=SwpmSettings::get_instance();
  7. $force_strong_pass=$settings->get_value('force-strong-passwords');
  8. if (!empty($force_strong_pass)) {
  9. $pass_class="validate[custom[strongPass],minSize[8]]";
  10. } else {
  11. $pass_class="";
  12. }
  13. SimpleWpMembership::enqueue_validation_scripts();
  14. //The admin ajax causes an issue with the JS validation if done on form submission. The edit profile doesn't need JS validation on email. There is PHP validation which will catch any email error.
  15. //SimpleWpMembership::enqueue_validation_scripts(array('ajaxEmailCall' => array('extraData'=>'&action=swpm_validate_email&member_id='.SwpmAuth::get_instance()->get('member_id'))));
  16. ?>
  17. <div class="swpm-edit-profile-form">
  18. <form id="swpm-editprofile-form" name="swpm-editprofile-form" method="post" action="" class="swpm-validate-form">
  19. <?php wp_nonce_field('swpm_profile_edit_nonce_action', 'swpm_profile_edit_nonce_val') ?>
  20. <table>
  21. <?php apply_filters('swpm_edit_profile_form_before_username', ''); ?>
  22. <tr class="swpm-profile-username-row" <?php apply_filters('swpm_edit_profile_form_username_tr_attributes', ''); ?>>
  23. <td><label for="user_name"><?php echo SwpmUtils::_('Username'); ?></label></td>
  24. <td><?php echo $user_name ?></td>
  25. </tr>
  26. <tr class="swpm-profile-email-row">
  27. <td><label for="email"><?php echo SwpmUtils::_('Email'); ?></label></td>
  28. <td><input type="text" id="email" name="email" size="50" autocomplete="off" class="" value="<?php echo $email; ?>" /></td>
  29. </tr>
  30. <tr class="swpm-profile-password-row">
  31. <td><label for="password"><?php echo SwpmUtils::_('Password'); ?></label></td>
  32. <td><input type="password" id="password" value="" size="50" name="password" class="<?php echo $pass_class;?>" autocomplete="off" placeholder="<?php echo SwpmUtils::_('Leave empty to keep the current password'); ?>" /></td>
  33. </tr>
  34. <tr class="swpm-profile-password-retype-row">
  35. <td><label for="password_re"><?php echo SwpmUtils::_('Repeat Password'); ?></label></td>
  36. <td><input type="password" id="password_re" value="" size="50" name="password_re" autocomplete="off" placeholder="<?php echo SwpmUtils::_('Leave empty to keep the current password'); ?>" /></td>
  37. </tr>
  38. <tr class="swpm-profile-firstname-row" <?php apply_filters('swpm_edit_profile_form_firstname_tr_attributes', ''); ?>>
  39. <td><label for="first_name"><?php echo SwpmUtils::_('First Name'); ?></label></td>
  40. <td><input type="text" id="first_name" value="<?php echo $first_name; ?>" size="50" name="first_name" /></td>
  41. </tr>
  42. <tr class="swpm-profile-lastname-row" <?php apply_filters('swpm_edit_profile_form_lastname_tr_attributes', ''); ?>>
  43. <td><label for="last_name"><?php echo SwpmUtils::_('Last Name'); ?></label></td>
  44. <td><input type="text" id="last_name" value="<?php echo $last_name; ?>" size="50" name="last_name" /></td>
  45. </tr>
  46. <tr class="swpm-profile-phone-row" <?php apply_filters('swpm_edit_profile_form_phone_tr_attributes', ''); ?>>
  47. <td><label for="phone"><?php echo SwpmUtils::_('Phone'); ?></label></td>
  48. <td><input type="text" id="phone" value="<?php echo $phone; ?>" size="50" name="phone" /></td>
  49. </tr>
  50. <tr class="swpm-profile-street-row" <?php apply_filters('swpm_edit_profile_form_street_tr_attributes', ''); ?>>
  51. <td><label for="address_street"><?php echo SwpmUtils::_('Street'); ?></label></td>
  52. <td><input type="text" id="address_street" value="<?php echo $address_street; ?>" size="50" name="address_street" /></td>
  53. </tr>
  54. <tr class="swpm-profile-city-row" <?php apply_filters('swpm_edit_profile_form_city_tr_attributes', ''); ?>>
  55. <td><label for="address_city"><?php echo SwpmUtils::_('City'); ?></label></td>
  56. <td><input type="text" id="address_city" value="<?php echo $address_city; ?>" size="50" name="address_city" /></td>
  57. </tr>
  58. <tr class="swpm-profile-state-row" <?php apply_filters('swpm_edit_profile_form_state_tr_attributes', ''); ?>>
  59. <td><label for="address_state"><?php echo SwpmUtils::_('State'); ?></label></td>
  60. <td><input type="text" id="address_state" value="<?php echo $address_state; ?>" size="50" name="address_state" /></td>
  61. </tr>
  62. <tr class="swpm-profile-zipcode-row" <?php apply_filters('swpm_edit_profile_form_zipcode_tr_attributes', ''); ?>>
  63. <td><label for="address_zipcode"><?php echo SwpmUtils::_('Zipcode'); ?></label></td>
  64. <td><input type="text" id="address_zipcode" value="<?php echo $address_zipcode; ?>" size="50" name="address_zipcode" /></td>
  65. </tr>
  66. <tr class="swpm-profile-country-row" <?php apply_filters('swpm_edit_profile_form_country_tr_attributes', ''); ?>>
  67. <td><label for="country"><?php echo SwpmUtils::_('Country'); ?></label></td>
  68. <td><select id="country" name="country"><?php echo SwpmMiscUtils::get_countries_dropdown($country) ?></select></td>
  69. </tr>
  70. <tr class="swpm-profile-company-row" <?php apply_filters('swpm_edit_profile_form_company_tr_attributes', ''); ?>>
  71. <td><label for="company_name"><?php echo SwpmUtils::_('Company Name'); ?></label></td>
  72. <td><input type="text" id="company_name" value="<?php echo $company_name; ?>" size="50" name="company_name" /></td>
  73. </tr>
  74. <tr class="swpm-profile-membership-level-row" <?php apply_filters('swpm_edit_profile_form_membership_level_tr_attributes', ''); ?>>
  75. <td><label for="membership_level"><?php echo SwpmUtils::_('Membership Level'); ?></label></td>
  76. <td>
  77. <?php echo $membership_level_alias; ?>
  78. </td>
  79. </tr>
  80. <?php apply_filters('swpm_edit_profile_form_after_membership_level', ''); ?>
  81. </table>
  82. <?php apply_filters('swpm_edit_profile_form_before_submit', ''); ?>
  83. <p class="swpm-edit-profile-submit-section">
  84. <input type="submit" value="<?php echo SwpmUtils::_('Update') ?>" class="swpm-edit-profile-submit" name="swpm_editprofile_submit" />
  85. </p>
  86. <?php echo SwpmUtils::delete_account_button(); ?>
  87. <input type="hidden" name="action" value="custom_posts" />
  88. </form>
  89. </div>