add (copia).php 6.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. <tr class="swpm-registration-membership-level-row" <?php apply_filters('swpm_registration_form_membership_level_tr_attributes', ''); ?>>
  42. <td><label for="membership_level"><?php echo SwpmUtils::_('Membership Level') ?></label></td>
  43. <td>
  44. <?php
  45. echo $membership_level_alias; //Show the level name in the form.
  46. //Add the input fields for the level data.
  47. echo '<input type="hidden" value="' . $membership_level . '" size="50" name="membership_level" id="membership_level" />';
  48. //Add the level input verification data.
  49. $swpm_p_key = get_option('swpm_private_key_one');
  50. if (empty($swpm_p_key)) {
  51. $swpm_p_key = uniqid('', true);
  52. update_option('swpm_private_key_one', $swpm_p_key);
  53. }
  54. $swpm_level_hash = md5($swpm_p_key . '|' . $membership_level); //level hash
  55. echo '<input type="hidden" name="swpm_level_hash" value="' . $swpm_level_hash . '" />';
  56. ?>
  57. </td>
  58. </tr>
  59. <?php
  60. apply_filters('swpm_registration_form_before_terms_and_conditions', '');
  61. //check if we need to display Terms and Conditions checkbox
  62. $terms_enabled = $settings->get_value('enable-terms-and-conditions');
  63. if (!empty($terms_enabled)) {
  64. $terms_page_url = $settings->get_value('terms-and-conditions-page-url');
  65. ?>
  66. <tr>
  67. <td colspan="2" style="text-align: center;">
  68. <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>
  69. </td>
  70. </tr>
  71. <?php
  72. }
  73. //check if we need to display Privacy Policy checkbox
  74. $pp_enabled = $settings->get_value('enable-privacy-policy');
  75. if (!empty($pp_enabled)) {
  76. $pp_page_url = $settings->get_value('privacy-policy-page-url');
  77. ?>
  78. <tr>
  79. <td colspan="2" style="text-align: center;">
  80. <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>
  81. </td>
  82. </tr>
  83. <?php
  84. }
  85. ?>
  86. </table>
  87. <div class="swpm-before-registration-submit-section" align="center"><?php echo apply_filters('swpm_before_registration_submit_button', ''); ?></div>
  88. <div class="swpm-registration-submit-section" align="center">
  89. <input type="submit" value="<?php echo SwpmUtils::_('Register') ?>" class="swpm-registration-submit" name="swpm_registration_submit" />
  90. </div>
  91. <input type="hidden" name="action" value="custom_posts" />
  92. </form>
  93. </div>