Ticket #2517: 2517.005.patch
File 2517.005.patch, 6.0 KB (added by , 15 years ago) |
---|
-
buddypress/bp-core/bp-core-settings.php
30 30 /**** GENERAL SETTINGS ****/ 31 31 32 32 function bp_core_screen_general_settings() { 33 global $current_user, $bp_settings_updated, $pass_error ;33 global $current_user, $bp_settings_updated, $pass_error, $email_error, $pwd_error; 34 34 35 35 $bp_settings_updated = false; 36 36 $pass_error = false; 37 $email_error = false; 38 $pwd_error = false; 37 39 38 40 if ( isset($_POST['submit']) ) { 39 41 check_admin_referer('bp_settings_general'); … … 41 43 require_once( WPINC . '/registration.php' ); 42 44 43 45 // Form has been submitted and nonce checks out, lets do it. 46 47 //we want to validate the user again for the current password when making a big change 48 if ( !empty( $_POST['pwd'] ) && $_POST['pwd'] != '' && wp_check_password($_POST['pwd'], $current_user->user_pass, $current_user->ID) ) { 49 50 //need to make sure changing an email address does not already exist 51 if ( $_POST['email'] != '' ) { 52 53 //what is missing from the profile page vs signup - lets double check the goodies 54 $user_email = sanitize_email( wp_specialchars( trim( $_POST['email'] ) ) ); 55 56 if ( !is_email( $user_email ) ) 57 $email_error = true; 58 59 $limited_email_domains = get_site_option( 'limited_email_domains', 'buddypress' ); 60 61 if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) { 62 $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) ); 63 64 if ( in_array( $emaildomain, (array)$limited_email_domains ) == false ) { 65 $email_error = true; 66 67 } 68 } 69 70 if ( !$email_error && $current_user->user_email != $user_email ) { 71 72 //we don't want email dups in the system 73 if ( email_exists( $user_email ) ) 74 $email_error = true; 75 76 if (!$email_error) 77 $current_user->user_email = $user_email; 78 } 79 } 44 80 45 if ( $_POST['email'] != '' ) 46 $current_user->user_email = wp_specialchars( trim( $_POST['email'] ) ); 81 if ( $_POST['pass1'] != '' && $_POST['pass2'] != '' ) { 82 83 if ( $_POST['pass1'] == $_POST['pass2'] && !strpos( " " . $_POST['pass1'], "\\" ) ) 84 $current_user->user_pass = $_POST['pass1']; 85 else 86 $pass_error = true; 47 87 48 if ( $_POST['pass1'] != '' && $_POST['pass2'] != '' ) { 49 if ( $_POST['pass1'] == $_POST['pass2'] && !strpos( " " . $_POST['pass1'], "\\" ) ) 50 $current_user->user_pass = $_POST['pass1']; 51 else 88 } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) { 52 89 $pass_error = true; 53 } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) { 54 $pass_error = true; 90 } else { 91 unset( $current_user->user_pass ); 92 } 93 94 if ( !$email_error && !$pass_error && wp_update_user( get_object_vars( $current_user ) ) ) 95 $bp_settings_updated = true; 96 55 97 } else { 56 unset( $current_user->user_pass );98 $pwd_error = true; 57 99 } 58 59 if ( !$pass_error && wp_update_user( get_object_vars( $current_user ) ) ) 60 $bp_settings_updated = true; 100 61 101 } 62 102 63 103 add_action( 'bp_template_title', 'bp_core_screen_general_settings_title' ); … … 71 111 } 72 112 73 113 function bp_core_screen_general_settings_content() { 74 global $bp, $current_user, $bp_settings_updated, $pass_error ; ?>114 global $bp, $current_user, $bp_settings_updated, $pass_error, $pwd_error, $email_error; ?> 75 115 76 116 <?php if ( $bp_settings_updated && !$pass_error ) { ?> 77 117 <div id="message" class="updated fade"> … … 84 124 <p><?php _e( 'Your passwords did not match', 'buddypress' ) ?></p> 85 125 </div> 86 126 <?php } ?> 127 128 <?php if ( $pwd_error && !$bp_settings_updated ) { ?> 129 <div id="message" class="error fade"> 130 <p><?php _e( 'Your password is incorrect', 'buddypress' ) ?></p> 131 </div> 132 <?php } ?> 133 134 <?php 135 if ( $email_error && !$bp_settings_updated ) { ?> 136 <div id="message" class="error fade"> 137 <p><?php _e( 'Sorry, that email address is already used or is invalid', 'buddypress' ) ?></p> 138 </div> 139 <?php } ?> 140 87 141 88 142 <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/general' ?>" method="post" class="standard-form" id="settings-form"> 143 144 <label for="pwd"><?php _e( 'Current Password <span>(required to update email or change current password)</span>', 'buddypress' ) ?></label> 145 <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" /> <a href="<?php echo site_url('wp-login.php?action=lostpassword', 'login') ?>" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a> 146 89 147 <label for="email"><?php _e( 'Account Email', 'buddypress' ) ?></label> 90 148 <input type="text" name="email" id="email" value="<?php echo attribute_escape( $current_user->user_email ); ?>" class="settings-input" /> 91 149 … … 128 186 } 129 187 130 188 function bp_core_screen_notification_settings_title() { 131 _e( ' Notification Settings', 'buddypress' );189 _e( 'Email Notifications', 'buddypress' ); 132 190 } 133 191 134 192 function bp_core_screen_notification_settings_content() { … … 141 199 <?php } ?> 142 200 143 201 <form action="<?php echo $bp->loggedin_user->domain . BP_SETTINGS_SLUG . '/notifications' ?>" method="post" id="settings-form"> 144 <h3><?php _e( 'Email Notifications', 'buddypress' ) ?></h3>145 202 <p><?php _e( 'Send a notification by email when:', 'buddypress' ) ?></p> 146 203 147 204 <?php do_action( 'bp_notification_settings' ) ?> -
buddypress/bp-themes/bp-default/members/single/plugins.php
30 30 </ul> 31 31 </div><!-- .item-list-tabs --> 32 32 33 < ?php do_action( 'bp_template_title' ) ?>33 <h3><?php do_action( 'bp_template_title' ) ?></h3> 34 34 35 35 <?php do_action( 'bp_template_content' ) ?> 36 36