Plugin Directory

Changeset 1355386


Ignore:
Timestamp:
02/22/2016 01:49:45 AM (10 years ago)
Author:
Cimmo
Message:

Added option to opt-in for plain text password included in the welcome email
Fixed welcome email for new users (WordPress MS only)

Location:
cimy-user-extra-fields/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cimy-user-extra-fields/trunk/README_OFFICIAL.txt

    r1354953 r1355386  
    633633CHANGELOG:
    634634v2.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)
    635637- Fixed registration rules were applied on profile update when certain plug-ins are installed, like bbpress (thanks to Vane R.)
    636638- 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  
    294294        }
    295295
     296        if (version_compare($options['version'], "2.7.1", "<=") === true) {
     297            $options["email_include_plaintext_password"] = false;
     298        }
     299
    296300        $options['version'] = $cimy_uef_version;
    297301
     
    379383        'password_meter' => false,
    380384        'mail_include_fields' => false,
     385        'email_include_plaintext_password' => false,
    381386        'redirect_to' => '',
    382387        'file_fields' => array(
  • cimy-user-extra-fields/trunk/cimy_uef_email_handler.php

    r1354609 r1355386  
    1818    $options = cimy_get_options();
    1919    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!
    2432            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                                        );
    2843    }
    2944}
     
    3651}
    3752
    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;
     53function 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;
    4062    $user = new WP_User($user_id);
    4163
     
    6991
    7092    $message = str_replace("USERNAME", $user_login, $welcome_email);
    71     if ( empty($plaintext_pass) ) {
     93
     94    if (empty($plaintext_pass)) {
    7295        // Generate something random for a password reset key.
    7396        $key = wp_generate_password( 20, false );
     
    87110        $pass_link .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
    88111        $message = str_replace("PASSWORD", $pass_link, $message);
     112    } else if ($include_plaintext_password) {
     113        $message = str_replace("PASSWORD", $plaintext_pass, $message);
    89114    } else {
    90         $message = str_replace("PASSWORD", $plaintext_pass, $message);
     115        $message = str_replace("PASSWORD", __('Your chosen password.', $cimy_uef_domain), $message);
    91116    }
    92117
     
    284309    global $wpdb, $current_site, $cimy_uef_domain;
    285310
    286     // seems no more required since WP 3.1
    287 //  require_once( ABSPATH . WPINC . '/registration.php');
    288311    $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM ".$wpdb->base_prefix."signups WHERE activation_key = %s", $key) );
    289312
     
    301324        $password = $meta["cimy_uef_wp_PASSWORD"];
    302325    else
    303         $password = wp_generate_password();
     326        $password = wp_generate_password(12, false);
    304327
    305328    $user_id = username_exists($user_login);
     
    319342    cimy_register_user_extra_fields($user_id, $password, $meta);
    320343
    321     if ((empty($meta["cimy_uef_wp_PASSWORD"])) && ($user_already_exists))
     344    if (empty($meta["cimy_uef_wp_PASSWORD"]) && $user_already_exists) {
    322345        update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
     346    }
    323347
    324348    $now = current_time('mysql', true);
     
    330354
    331355    $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"]);
    333357    return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta);
    334358}
  • cimy-user-extra-fields/trunk/cimy_uef_options.php

    r1353917 r1355386  
    129129    $action = "add";
    130130
    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;
    133133    if ($options['confirm_email'])
    134134        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;
    137138
    138139    if (isset($_POST['captcha']))
     
    374375            screen_icon("options-general");
    375376    ?>
    376     <h2><?php _e("Options");
     377    <h2><?php _e("Settings");
    377378   
    378379    if (!isset($cimy_top_menu)) {
     
    463464            </td>
    464465        </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>
    465477<?php if (!is_multisite()) { ?>
    466478        <tr>
Note: See TracChangeset for help on using the changeset viewer.