Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1. <form method="post" class="wp-user-form " id="wp_signup_form_' . $rand_id . '" enctype="multipart/form-data">
  2.  
  3. <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12">';
  4. $cs_opt_array = array(
  5. 'id' => '',
  6. 'std' => '',
  7. 'cust_id' => 'user_login_' . $rand_id,
  8. 'cust_name' => 'user_login' . $rand_id,
  9. 'classes' => 'form-control',
  10. 'extra_atr' => ' size="20" tabindex="101" placeholder="' . __('Username*', 'theme_domain') . '"',
  11. 'return' => true,
  12. );
  13. $output .= $cs_form_fields2->cs_form_text_render($cs_opt_array);
  14.  
  15. $output .= '</div>';
  16. $output .=$cs_form_fields_frontend->cs_form_text_render(
  17. array('name' => __('Email*', 'theme_domain'),
  18. 'id' => 'user_email' . $rand_id . '',
  19. 'classes' => 'col-md-12 col-lg-12 col-sm-12 col-xs-12',
  20. 'std' => '',
  21. 'description' => '',
  22. 'return' => true,
  23. 'hint' => ''
  24. )
  25. );
  26. $output .=$cs_form_fields_frontend->cs_form_hidden_render(
  27. array('name' => __('Post Type', 'theme_domain'),
  28. 'id' => 'user_role_type' . $rand_id . '',
  29. 'classes' => 'col-md-12 col-lg-12 col-sm-12 col-xs-12',
  30. 'std' => 'candidate',
  31. 'description' => '',
  32. 'return' => true,
  33. 'hint' => ''
  34. )
  35. );
  36. if (is_user_logged_in()) {
  37. $output .= '<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">';
  38.  
  39. $cs_opt_array = array(
  40. 'id' => '',
  41. 'std' => __('Create Account', 'theme_domain'),
  42. 'cust_id' => 'submitbtn' . $rand_id,
  43. 'cust_name' => 'user-submit',
  44. 'cust_type' => 'button',
  45. 'extra_atr' => ' tabindex="103" onclick="javascript:show_alert_msg('' . __("Please logout first then try to registration again", "theme_domain") . '')"',
  46. 'classes' => 'cs-bgcolor user-submit acc-submit',
  47. 'return' => true,
  48. );
  49. $output .= $cs_form_fields2->cs_form_text_render($cs_opt_array);
  50.  
  51. $output .= '
  52. <!--</div>-->
  53. </div>';
  54. } else {
  55. $output .= '<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12">';
  56.  
  57. $cs_opt_array = array(
  58. 'id' => '',
  59. 'std' => __('Create Account', 'theme_domain'),
  60. 'cust_id' => 'submitbtn' . $rand_id,
  61. 'cust_name' => 'user-submit',
  62. 'cust_type' => 'button',
  63. 'extra_atr' => ' tabindex="103" onclick="javascript:cs_registration_validation('' . admin_url("admin-ajax.php") . '','' . $rand_id . '')"',
  64. 'classes' => 'cs-bgcolor user-submit acc-submit',
  65. 'return' => true,
  66. );
  67. $output .= $cs_form_fields2->cs_form_text_render($cs_opt_array);
  68.  
  69. $cs_opt_array = array(
  70. 'id' => '',
  71. 'std' => $role,
  72. 'cust_id' => 'login-role',
  73. 'cust_name' => 'role',
  74. 'cust_type' => 'hidden',
  75. 'return' => true,
  76. );
  77. $output .= $cs_form_fields2->cs_form_text_render($cs_opt_array);
  78.  
  79. $cs_opt_array = array(
  80. 'id' => '',
  81. 'std' => 'cs_registration_validation',
  82. 'cust_name' => 'action',
  83. 'cust_type' => 'hidden',
  84. 'return' => true,
  85. );
  86. $output .= $cs_form_fields2->cs_form_text_render($cs_opt_array);
  87.  
  88. $output .= '
  89. </div>
  90. ';
  91. }
  92.  
  93. $output .='
  94. <div class="col-md-6 col-lg-6 col-sm-12 col-xs-12 login-section">
  95. <i class="icon-user-add"></i> ' . __("Already have an account?", "theme_domain") . '
  96. <a href="#" class="login-link-page">' . __('Login Now', 'theme_domain') . '</a>
  97. </div>
  98. </div>
  99. </div>
  100. <div id="result_' . $rand_id . '" class="status-message"><p class="status"></p></div>
  101. </div>';
  102. $output .='</form>';
  103. $output .='</div>';
  104.  
  105. function mytheme_registration_save($user_id) {
  106.  
  107.  
  108. if ( isset($_REQUEST['action']) && $_REQUEST['action'] == 'register' ) {
  109.  
  110. $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
  111. wp_set_password($random_password, $user_id);
  112. $reg_user = get_user_by('ID', $user_id);
  113. if ( isset($reg_user->roles) && (in_array('subscriber', $reg_user->roles) || in_array('editor', $reg_user->roles) || in_array('author', $reg_user->roles)) ) {
  114. // Site owner email hook
  115. do_action('theme_domain_new_user_notification_site_owner', $reg_user->data->user_login, $reg_user->data->user_email);
  116. // normal user email hook
  117. do_action('theme_domain_user_register', $reg_user, $random_password);
  118. }
  119. }
  120. }
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement