add.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. SimpleWpMembership::enqueue_validation_scripts(array('ajaxEmailCall' => array('extraData' => '&action=swpm_validate_email&member_id=' . filter_input(INPUT_GET, 'member_id'))));
  3. $settings = SwpmSettings::get_instance();
  4. $force_strong_pass = $settings->get_value('force-strong-passwords');
  5. if (!empty($force_strong_pass)) {
  6. $pass_class = "validate[required,custom[strongPass],minSize[8]]";
  7. } else {
  8. $pass_class = "";
  9. }
  10. // Filter allowing to change the default value of user_name
  11. $user_name = apply_filters('swpm_registration_form_set_username', $user_name);
  12. ?>
  13. <div class="swpm-registration-widget-form">
  14. <form id="swpm-registration-form" class="swpm-validate-form" name="swpm-registration-form" method="post" action="">
  15. <input type ="hidden" name="level_identifier" value="<?php echo $level_identifier ?>" />
  16. <table>
  17. <tr class="swpm-registration-username-row" <?php apply_filters('swpm_registration_form_username_tr_attributes', ''); ?>>
  18. <td><label for="user_name"><?php echo SwpmUtils::_('Username') ?></label></td>
  19. <td><input type="text" id="user_name" class="validate[required,custom[noapostrophe],custom[SWPMUserName],minSize[4],ajax[ajaxUserCall]]" value="<?php echo esc_attr($user_name); ?>" size="50" name="user_name" <?php apply_filters('swpm_registration_form_username_input_attributes', ''); ?>/></td>
  20. </tr>
  21. <tr class="swpm-registration-email-row">
  22. <td><label for="email"><?php echo SwpmUtils::_('Email') ?></label></td>
  23. <td><input type="text" autocomplete="off" id="email" class="validate[required,custom[email],ajax[ajaxEmailCall]]" value="<?php echo esc_attr($email); ?>" size="50" name="email" /></td>
  24. </tr>
  25. <tr class="swpm-registration-password-row">
  26. <td><label for="password"><?php echo SwpmUtils::_('Password') ?></label></td>
  27. <td><input type="password" autocomplete="off" id="password" class="<?php echo $pass_class; ?>" value="" size="50" name="password" /></td>
  28. </tr>
  29. <tr class="swpm-registration-password-retype-row">
  30. <td><label for="password_re"><?php echo SwpmUtils::_('Repeat Password') ?></label></td>
  31. <td><input type="password" autocomplete="off" id="password_re" value="" size="50" name="password_re" /></td>
  32. </tr>
  33. <tr class="swpm-registration-firstname-row" <?php apply_filters('swpm_registration_form_firstname_tr_attributes', ''); ?>>
  34. <td><label for="first_name"><?php echo SwpmUtils::_('First Name') ?></label></td>
  35. <td><input type="text" id="first_name" value="<?php echo esc_attr($first_name); ?>" size="50" name="first_name" /></td>
  36. </tr>
  37. <tr class="swpm-registration-lastname-row" <?php apply_filters('swpm_registration_form_lastname_tr_attributes', ''); ?>>
  38. <td><label for="last_name"><?php echo SwpmUtils::_('Last Name') ?></label></td>
  39. <td><input type="text" id="last_name" value="<?php echo esc_attr($last_name); ?>" size="50" name="last_name" /></td>
  40. </tr>
  41. <!-- custom fields for anagraphic datas-->
  42. <tr class="swpm-registration-phone-row" <?php apply_filters('swpm_registration_form_phone_tr_attributes', ''); ?>>
  43. <td><label for="phone"><?php echo SwpmUtils::_('Phone') ?></label></td>
  44. <td><input type="text" id="phone" value="<?php echo esc_attr($phone); ?>" size="50" name="phone" /></td>
  45. </tr>
  46. <tr class="swpm-registration-address-street-row">
  47. <th><label for="address_street"><?php echo SwpmUtils::_('Street') ?> di residenza</label></th>
  48. <td><input class="regular-text" name="address_street" type="text" id="address_street" value="<?php echo esc_attr($address_street); ?>" /></td>
  49. </tr>
  50. <tr class="swpm-registration-address-city-row">
  51. <th><label for="address_city"><?php echo SwpmUtils::_('City') ?> di residenza </label></th>
  52. <td><input class="regular-text" name="address_city" type="text" id="address_city" value="<?php echo esc_attr($address_city); ?>" /></td>
  53. </tr>
  54. <tr class="swpm-registration-address-state-row">
  55. <th><label for="address_state"><?php echo SwpmUtils::_('State') ?> di residenza</label></th>
  56. <td><input class="regular-text" name="address_state" type="text" id="address_state" value="<?php echo esc_attr($address_state); ?>" /></td>
  57. </tr>
  58. <tr class="swpm-registration-address-zipcode-row">
  59. <th><label for="address_zipcode"><?php echo SwpmUtils::_('Zipcode') ?> di residenza</label></th>
  60. <td><input class="regular-text" name="address_zipcode" type="text" id="address_zipcode" value="<?php echo esc_attr($address_zipcode); ?>" /></td>
  61. </tr>
  62. <tr class="swpm-registration-address-country-row">
  63. <th><label for="country"><?php echo SwpmUtils::_('Country') ?> di residenza</label></th>
  64. <td><select class="regular-text" id="country" name="country"><?php echo SwpmMiscUtils::get_countries_dropdown($country) ?></select></td>
  65. </tr>
  66. <tr class="swpm-registration-birthplace-row" <?php apply_filters('swpm_registration_form_birthplace_tr_attributes', ''); ?>>
  67. <td><label for="birth_place"><?php echo SwpmUtils::_('Luogo di Nascita') ?></label></td>
  68. <td><input type="text" id="birth_place" value="<?php echo esc_attr($birth_place); ?>" size="50" name="birth_place" /></td>
  69. </tr>
  70. <tr class="swpm-registration-birthdate-row" <?php apply_filters('swpm_registration_form_birthdate_tr_attributes', ''); ?>>
  71. <th scope="row"><label for="birth_date"><?php echo SwpmUtils::_('Data di nascita') ?> </label></th>
  72. <td><input name="birth_date" type="date" id="birth_date" value="<?php echo esc_attr($birth_date); ?>" /></td>
  73. </tr>
  74. <tr class="swpm-registration-membership-level-row" <?php apply_filters('swpm_registration_form_membership_level_tr_attributes', ''); ?>>
  75. <td><label for="membership_level"><?php echo SwpmUtils::_('Membership Level') ?></label></td>
  76. <td>
  77. <?php
  78. echo $membership_level_alias; //Show the level name in the form.
  79. //Add the input fields for the level data.
  80. echo '<input type="hidden" value="' . $membership_level . '" size="50" name="membership_level" id="membership_level" />';
  81. //Add the level input verification data.
  82. $swpm_p_key = get_option('swpm_private_key_one');
  83. if (empty($swpm_p_key)) {
  84. $swpm_p_key = uniqid('', true);
  85. update_option('swpm_private_key_one', $swpm_p_key);
  86. }
  87. $swpm_level_hash = md5($swpm_p_key . '|' . $membership_level); //level hash
  88. echo '<input type="hidden" name="swpm_level_hash" value="' . $swpm_level_hash . '" />';
  89. ?>
  90. </td>
  91. </tr>
  92. <?php
  93. apply_filters('swpm_registration_form_before_terms_and_conditions', '');
  94. //check if we need to display Terms and Conditions checkbox
  95. $terms_enabled = $settings->get_value('enable-terms-and-conditions');
  96. if (!empty($terms_enabled)) {
  97. $terms_page_url = $settings->get_value('terms-and-conditions-page-url');
  98. ?>
  99. <tr>
  100. <td colspan="2" style="text-align: center;">
  101. <label><input type="checkbox" id="accept_terms" name="accept_terms" class="validate[required]" value="1"> <?php echo SwpmUtils::_('I accept the ') ?> <a href="<?php echo $terms_page_url; ?>" target="_blank"><?php echo SwpmUtils::_('Terms and Conditions') ?></a></label>
  102. </td>
  103. </tr>
  104. <?php
  105. }
  106. //check if we need to display Privacy Policy checkbox
  107. $pp_enabled = $settings->get_value('enable-privacy-policy');
  108. if (!empty($pp_enabled)) {
  109. $pp_page_url = $settings->get_value('privacy-policy-page-url');
  110. ?>
  111. <tr>
  112. <td colspan="2" style="text-align: center;">
  113. <label><input type="checkbox" id="accept_pt" name="accept_pp" class="validate[required]" value="1"> <?php echo SwpmUtils::_('I agree to the ') ?> <a href="<?php echo $pp_page_url; ?>" target="_blank"><?php echo SwpmUtils::_('Privacy Policy') ?></a></label>
  114. </td>
  115. </tr>
  116. <?php
  117. }
  118. ?>
  119. </table>
  120. <div class="swpm-before-registration-submit-section" align="center"><?php echo apply_filters('swpm_before_registration_submit_button', ''); ?></div>
  121. <div class="swpm-registration-submit-section" align="center">
  122. <input type="submit" value="<?php echo SwpmUtils::_('Register') ?>" class="swpm-registration-submit" name="swpm_registration_submit" />
  123. </div>
  124. <input type="hidden" name="action" value="custom_posts" />
  125. </form>
  126. </div>