rdusnr

Untitled

Jan 17th, 2017
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.15 KB | None | 0 0
  1. <?php
  2. /**
  3. * Register Form shortcode
  4. * [kleo_register register_title="Create Account" show_for_users=""]
  5. *
  6. * @package WordPress
  7. * @subpackage K Elements
  8. * @author SeventhQueen <[email protected]>
  9. * @since K Elements 4.0
  10. */
  11.  
  12. $style = $el_class = $input_size = $register_title = $show_for_users = $bp_plugins_hook = '';
  13.  
  14. extract( shortcode_atts( array(
  15. 'register_title' => __( "Create Account", "k-elements" ),
  16. 'style' => 'white',
  17. 'input_size' => 'normal',
  18. 'show_for_users' => '',
  19. 'bp_plugins_hook' => '',
  20. 'el_class' => '',
  21. ), $atts ) );
  22.  
  23. if ( is_user_logged_in() ) {
  24. $show_content = false;
  25.  
  26. if ( $show_for_users != '' ) {
  27. $show_content = true;
  28. }
  29. } else {
  30. $show_content = true;
  31. }
  32.  
  33. if( $show_content && get_option('users_can_register') ) {
  34.  
  35. ob_start();
  36.  
  37. //$register_link = apply_filters('kleo_register_form_custom_link', function_exists('bp_is_active') ? bp_get_signup_page() : get_bloginfo('url') . "/wp-login.php?action=register");
  38. $register_link = apply_filters('kleo_register_form_custom_link', function_exists('bp_is_active') ? bp_get_signup_page() : wp_registration_url());
  39. $el_class = ( $el_class != '' ) ? 'kleo-register-inline ' . esc_attr( $el_class ) : 'kleo-register-inline';
  40. $el_class .= ' kleo-register-style-' . esc_attr( $style );
  41. $el_class .= ' kleo-register-size-' . esc_attr( $input_size );
  42.  
  43. $output_inside = '';
  44.  
  45. ?>
  46. <div class="row">
  47. <div class="col-md-12 text-center">
  48.  
  49. <?php do_action('kleo_before_register_form_modal'); ?>
  50.  
  51. <?php if( $register_title != '' ){ ?>
  52. <div class="kleo-pop-title-wrap">
  53. <h3 class="kleo-pop-title"><?php echo esc_html($register_title); ?></h3>
  54. </div>
  55. <?php } ?>
  56.  
  57. <form id="register_form" class="kleo-form-register" action="<?php echo esc_url($register_link); ?>" name="signup_form" method="post">
  58. <div class="row">
  59. <?php if (function_exists( 'bp_is_active' )) { ?>
  60. <div class="col-sm-6 first-col">
  61. <input type="text" id="reg-username" name="signup_username" class="form-control" required placeholder="<?php _e("Username", 'k-elements');?>">
  62. </div>
  63. <div class="col-sm-6 last-col">
  64. <input type="text" id="fullname" name="field_1" class="form-control" required placeholder="<?php _e("Your full name", 'k-elements');?>">
  65. </div>
  66. <div class="clear"></div>
  67. <div class="col-sm-12">
  68. <input type="text" id="reg-email" name="signup_email" class="form-control" required placeholder="<?php _e("Your email", 'k-elements');?>">
  69. </div>
  70. <div class="clear"></div>
  71. <div class="col-sm-6 first-col">
  72. <input type="password" id="reg-password" name="signup_password" class="form-control" required placeholder="<?php _e("Desired password", 'k-elements');?>">
  73. </div>
  74. <div class="col-sm-6 last-col">
  75. <input type="password" id="confirm_password" name="signup_password_confirm" class="form-control" required placeholder="<?php _e("Confirm password", 'k-elements');?>">
  76. </div>
  77. <input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="1" />
  78. <?php wp_nonce_field( 'bp_new_signup' ); ?>
  79. <?php } else { ?>
  80. <div class="col-sm-12">
  81. <input type="text" id="reg-username" name="user_login" class="form-control" required placeholder="<?php _e("Username", 'k-elements');?>">
  82. </div>
  83. <div class="col-sm-12">
  84. <input type="text" id="reg-email" name="user_email" class="form-control" required placeholder="<?php _e("Your email", 'k-elements');?>">
  85. </div>
  86. <?php } ?>
  87. </div>
  88.  
  89. <?php /***** Extra Profile Details ******/ ?>
  90.  
  91. <?php if ( bp_is_active( 'xprofile' ) ) : ?>
  92.  
  93. <?php do_action( 'bp_before_signup_profile_fields' ); ?>
  94.  
  95. <div class="register-section" id="profile-details-section">
  96.  
  97. <h4><?php _e( 'Profile Details', 'buddypress' ); ?></h4>
  98.  
  99. <?php /* Use the profile field loop to render input fields for the 'base' profile field group */ ?>
  100. <?php if ( bp_is_active( 'xprofile' ) ) : if ( bp_has_profile( array( 'profile_group_id' => 1, 'fetch_field_data' => false ) ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
  101.  
  102. <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
  103.  
  104. <div<?php bp_field_css_class( 'editfield' ); ?>>
  105.  
  106. <?php
  107. $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
  108. $field_type->edit_field_html();
  109.  
  110. do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
  111.  
  112. if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
  113.  
  114. <?php else : ?>
  115.  
  116. <?php endif ?>
  117. <?php do_action( 'bp_custom_profile_edit_fields' ); ?>
  118. <?php echo '<pre>';print_r(bp_the_profile_field_name()); echo '</pre>';?>
  119. </div>
  120.  
  121. <?php endwhile; ?>
  122.  
  123. <input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_group_field_ids(); ?>" class="form-control" placeholder="<?php echo bp_the_profile_field_name(); ?>"/>
  124.  
  125. <?php endwhile; endif; endif; ?>
  126.  
  127. <?php do_action( 'bp_signup_profile_fields' ); ?>
  128.  
  129. </div><!-- #profile-details-section -->
  130.  
  131. <?php do_action( 'bp_after_signup_profile_fields' ); ?>
  132.  
  133. <?php endif; ?>
  134.  
  135. </div>
  136.  
  137. <?php
  138. if ( $bp_plugins_hook != 'no' ) {
  139. do_action( 'bp_before_registration_submit_buttons' );
  140. }
  141. ?>
  142.  
  143. <button class="btn btn-lg btn-default btn-block" name="signup_submit" type="submit"><?php esc_html_e("Register", "k-elements"); ?></button>
  144. <span class="clearfix"></span>
  145. </form>
  146.  
  147. </div>
  148. </div>
  149. <?php
  150.  
  151. $output_inside = ob_get_clean();
  152. $output .= "\n\t" . "<div class=\"{$el_class}\">{$output_inside}</div>";
  153.  
  154. }
Advertisement
Add Comment
Please, Sign In to add comment