Changeset 1355386
- Timestamp:
- 02/22/2016 01:49:45 AM (10 years ago)
- Location:
- cimy-user-extra-fields/trunk
- Files:
-
- 4 edited
-
README_OFFICIAL.txt (modified) (1 diff)
-
cimy_uef_db.php (modified) (2 diffs)
-
cimy_uef_email_handler.php (modified) (8 diffs)
-
cimy_uef_options.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cimy-user-extra-fields/trunk/README_OFFICIAL.txt
r1354953 r1355386 633 633 CHANGELOG: 634 634 v2.7.2 - /02/2016 635 - Added option to opt-in for plain text password included in the welcome email 636 - Fixed welcome email for new users (WordPress MS only) 635 637 - Fixed registration rules were applied on profile update when certain plug-ins are installed, like bbpress (thanks to Vane R.) 636 638 - Fixed MYSQL error on WordPress MS when creating sites through other plug-ins (thanks to Kathy Goss) -
cimy-user-extra-fields/trunk/cimy_uef_db.php
r1354609 r1355386 294 294 } 295 295 296 if (version_compare($options['version'], "2.7.1", "<=") === true) { 297 $options["email_include_plaintext_password"] = false; 298 } 299 296 300 $options['version'] = $cimy_uef_version; 297 301 … … 379 383 'password_meter' => false, 380 384 'mail_include_fields' => false, 385 'email_include_plaintext_password' => false, 381 386 'redirect_to' => '', 382 387 'file_fields' => array( -
cimy-user-extra-fields/trunk/cimy_uef_email_handler.php
r1354609 r1355386 18 18 $options = cimy_get_options(); 19 19 if (!is_multisite()) { 20 if (!$options["confirm_email"]) 21 wp_new_user_notification_original($user_id, $plaintext_pass, $options["mail_include_fields"], false, cimy_wpml_translate_string("a_opt_welcome_email", $options["welcome_email"]), $notify); 22 // if confirmation email is enabled delete the default_password_nag but checks first if has not been done on top of this function! 23 else if (!isset($_POST["cimy_uef_wp_PASSWORD"])) 20 if (!$options["confirm_email"]) { 21 wp_new_user_notification_original($user_id, 22 $plaintext_pass, 23 $options["mail_include_fields"], 24 false, 25 cimy_wpml_translate_string("a_opt_welcome_email", $options["welcome_email"]), 26 $notify, 27 $options["email_include_plaintext_password"] 28 ); 29 } else if (!isset($_POST["cimy_uef_wp_PASSWORD"])) { 30 // if confirmation email is enabled delete the default_password_nag 31 // but checks first if has not been done on top of this function! 24 32 delete_user_meta($user_id, 'default_password_nag'); 25 } 26 else { 27 wp_new_user_notification_original($user_id, $plaintext_pass, $options["mail_include_fields"], $notify); 33 } 34 } else { 35 wp_new_user_notification_original($user_id, 36 $plaintext_pass, 37 $options["mail_include_fields"], 38 false, 39 '', 40 $notify, 41 $options["email_include_plaintext_password"] 42 ); 28 43 } 29 44 } … … 36 51 } 37 52 38 function wp_new_user_notification_original($user_id, $plaintext_pass = null, $include_fields = false, $activation_data = false, $welcome_email = '', $notify = '') { 39 global $wpdb, $wp_hasher; 53 function wp_new_user_notification_original($user_id, 54 $plaintext_pass = null, 55 $include_fields = false, 56 $activation_data = false, 57 $welcome_email = '', 58 $notify = '', 59 $include_plaintext_password = false 60 ) { 61 global $wpdb, $wp_hasher, $cimy_uef_domain; 40 62 $user = new WP_User($user_id); 41 63 … … 69 91 70 92 $message = str_replace("USERNAME", $user_login, $welcome_email); 71 if ( empty($plaintext_pass) ) { 93 94 if (empty($plaintext_pass)) { 72 95 // Generate something random for a password reset key. 73 96 $key = wp_generate_password( 20, false ); … … 87 110 $pass_link .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n"; 88 111 $message = str_replace("PASSWORD", $pass_link, $message); 112 } else if ($include_plaintext_password) { 113 $message = str_replace("PASSWORD", $plaintext_pass, $message); 89 114 } else { 90 $message = str_replace("PASSWORD", $plaintext_pass, $message);115 $message = str_replace("PASSWORD", __('Your chosen password.', $cimy_uef_domain), $message); 91 116 } 92 117 … … 284 309 global $wpdb, $current_site, $cimy_uef_domain; 285 310 286 // seems no more required since WP 3.1287 // require_once( ABSPATH . WPINC . '/registration.php');288 311 $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM ".$wpdb->base_prefix."signups WHERE activation_key = %s", $key) ); 289 312 … … 301 324 $password = $meta["cimy_uef_wp_PASSWORD"]; 302 325 else 303 $password = wp_generate_password( );326 $password = wp_generate_password(12, false); 304 327 305 328 $user_id = username_exists($user_login); … … 319 342 cimy_register_user_extra_fields($user_id, $password, $meta); 320 343 321 if ( (empty($meta["cimy_uef_wp_PASSWORD"])) && ($user_already_exists))344 if (empty($meta["cimy_uef_wp_PASSWORD"]) && $user_already_exists) { 322 345 update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag. 346 } 323 347 324 348 $now = current_time('mysql', true); … … 330 354 331 355 $options = cimy_get_options(); 332 wp_new_user_notification_original($user_id, $password, $options["mail_include_fields"], $meta, cimy_wpml_translate_string("a_opt_welcome_email", $options["welcome_email"]), 'both' );356 wp_new_user_notification_original($user_id, $password, $options["mail_include_fields"], $meta, cimy_wpml_translate_string("a_opt_welcome_email", $options["welcome_email"]), 'both', $options["email_include_plaintext_password"]); 333 357 return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta); 334 358 } -
cimy-user-extra-fields/trunk/cimy_uef_options.php
r1353917 r1355386 129 129 $action = "add"; 130 130 131 (isset($_POST['confirm_email'])) ? $options['confirm_email'] = true : $options['confirm_email'] = false;132 (isset($_POST['confirm_form'])) ? $options['confirm_form'] = true : $options['confirm_form'] = false;131 $options["confirm_email"] = empty($_POST['confirm_email']) ? false : true; 132 $options["confirm_form"] = empty($_POST['confirm_form']) ? false : true; 133 133 if ($options['confirm_email']) 134 134 cimy_force_signup_table_creation(); 135 (isset($_POST['redirect_to'])) ? $options['redirect_to'] = $_POST['redirect_to'] : $options['redirect_to'] = ""; 136 (isset($_POST['mail_include_fields'])) ? $options['mail_include_fields'] = true : $options['mail_include_fields'] = false; 135 $options["redirect_to"] = empty($_POST['redirect_to']) ? "" : $_POST['redirect_to']; 136 $options["mail_include_fields"] = empty($_POST['mail_include_fields']) ? false : true; 137 $options["email_include_plaintext_password"] = empty($_POST['email_include_plaintext_password']) ? false : true; 137 138 138 139 if (isset($_POST['captcha'])) … … 374 375 screen_icon("options-general"); 375 376 ?> 376 <h2><?php _e(" Options");377 <h2><?php _e("Settings"); 377 378 378 379 if (!isset($cimy_top_menu)) { … … 463 464 </td> 464 465 </tr> 466 <tr> 467 <th scope="row"> 468 <input type="checkbox" name="email_include_plaintext_password" id="email_include_plaintext_password" value="1"<?php checked(true, $options['email_include_plaintext_password'], true); ?> /> 469 <label for="email_include_plaintext_password"><?php _e("Show plain text password in the welcome email", $cimy_uef_domain); ?></label> 470 </th> 471 <td> 472 <?php 473 _e("the email sent to the user upon registration will include the user's password in plain text (may be useful, but less secure)", $cimy_uef_domain); 474 ?> 475 </td> 476 </tr> 465 477 <?php if (!is_multisite()) { ?> 466 478 <tr>
Note: See TracChangeset
for help on using the changeset viewer.