Changeset 522736
- Timestamp:
- 03/23/2012 05:36:20 PM (14 years ago)
- Location:
- wp-user-control/trunk
- Files:
-
- 4 edited
-
inc/WPUserControlWidget.php (modified) (8 diffs)
-
readme.txt (modified) (5 diffs)
-
screenshot-5.png (modified) (previous)
-
wp_uc_widget.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-user-control/trunk/inc/WPUserControlWidget.php
r517093 r522736 76 76 // first get options array from wordpress database 77 77 $arr = get_option( 78 $show = 'widget_wp-user-control-widget',79 $default = false80 );78 $show = 'widget_wp-user-control-widget', 79 $default = false 80 ); 81 81 // check to see if option array was successfully retrieved 82 82 if ( $arr !== false ) { … … 107 107 } 108 108 109 function wp_user_control_retrieve_password_email( $message, $key ) { 110 /* 111 * @todo: set up custom message for retrieve password email 112 */ 113 return $message; 109 /** 110 * 111 * Filter method to set custom email address for sending all WP administrative email. 112 * 113 * @param string $from_email 114 * @return string $from_email 115 */ 116 function wp_user_control_mail_from_filter( $from_email ) { 117 // first get options array from wordpress database 118 $arr = get_option( 119 $show = 'widget_wp-user-control-widget', 120 $default = false 121 ); 122 // check to see if option array was successfully retrieved 123 if ( $arr !== false ) { 124 // loop through options array from database 125 foreach ( $arr as $instance_id => $properties ) { 126 // make sure we're dealing with a valid instance id 127 if ( is_numeric( $instance_id ) && count( $properties ) > 1 ) { 128 // if mail from address is stored and not empty, return it 129 if ( !empty( $properties['mailFromAddress'] ) ) { 130 return $properties['mailFromAddress']; 131 // otherwise return default mail from 132 } else { 133 return $from_email; 134 } 135 // instance id is not valid, or no options are saved, return default login url 136 } else { 137 return $from_email; 138 } 139 } 140 // options array was not successfully retrieved, return default login url 141 } else { 142 return $from_email; 143 } 114 144 } 115 145 116 function wp_user_control_password_reset_email( $message, $key ) { 117 // set global for user_login 118 /* 119 * @todo: set up custom message for redirect to custom password reset location 120 */ 121 /* 122 global $user_login; 123 // build the message 124 $message = __( 'Someone has asked to reset the password for the following site and username.', 'wp-user-control' ) . "\r\n\r\n"; 125 $message .= network_site_url() . "\r\n\r\n"; 126 $message .= sprintf( __( 'Username: %s', 'wp-user-control' ), $user_login ) . "\r\n\r\n"; 127 $message .= __( 'To reset your password visit the following address, otherwise just ignore this email and nothing will happen.', 'wp-user-control' ) . "\r\n\r\n"; 128 $message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . "\r\n"; 129 */ 130 // return the new message 131 return $message; 146 /** 147 * 148 * Filter method to set custom name in from field for all WP administrative email. 149 * 150 * @param string $from_name 151 * @return string $from_name 152 */ 153 function wp_user_control_mail_from_name_filter( $from_name ) { 154 // first get options array from wordpress database 155 $arr = get_option( 156 $show = 'widget_wp-user-control-widget', 157 $default = false 158 ); 159 // check to see if option array was successfully retrieved 160 if ( $arr !== false ) { 161 // loop through options array from database 162 foreach ( $arr as $instance_id => $properties ) { 163 // make sure we're dealing with a valid instance id 164 if ( is_numeric( $instance_id ) && count( $properties ) > 1 ) { 165 // if mail from address is stored and not empty, return it 166 if ( !empty( $properties['mailFromName'] ) ) { 167 return $properties['mailFromName']; 168 // otherwise return default mail from 169 } else { 170 return $from_name; 171 } 172 // instance id is not valid, or no options are saved, return default login url 173 } else { 174 return $from_name; 175 } 176 } 177 // options array was not successfully retrieved, return default login url 178 } else { 179 return $from_name; 180 } 132 181 } 133 182 … … 193 242 ); // hook failed login 194 243 195 add_filter(196 $tag = 'password_reset_message',197 $function_to_add = 'wp_user_control_password_reset_email',198 $priority = 10,199 $accepted_args = 2200 ); // hook password reset message filter201 202 add_filter(203 $tag = 'retrieve_password_message',204 $function_to_add = 'wp_user_control_retrieve_password_email',205 $priority = 10,206 $accepted_args = 2207 ); // hook retrieve password message filter208 209 244 // add filter hooks 210 245 add_filter( … … 220 255 $priority = 10, 221 256 $accepted_args = 3 222 ); // hook failed registration 257 ); // hook failed registration 258 259 add_filter( 260 $tag = 'wp_mail_from', 261 $function_to_add = 'wp_user_control_mail_from_filter', 262 $priority = 10, 263 $accepted_args = 1 264 ); // hook mail from address 265 266 add_filter( 267 $tag = 'wp_mail_from_name', 268 $function_to_add = 'wp_user_control_mail_from_name_filter', 269 $priority = 10, 270 $accepted_args = 1 271 ); // hook mail from name 223 272 224 273 } // end constructor method … … 241 290 'loginButtonLabel' => __( 'Login', 'wp-user-control' ), 242 291 'loginTabLabel' => __( 'Login', 'wp-user-control' ), 292 'mailFromAddress' => get_option( 'admin_email' ), 293 'mailFromName' => get_option( 'blogname' ), 243 294 'resetTabLabel' => __( 'Reset', 'wp-user-control' ), 244 295 'resetButtonLabel' => __( 'Reset Password', 'wp-user-control' ), … … 364 415 'value' => $instance['customLink'] 365 416 ) ); 417 // output custom email address field 418 $this->outputFormField( array( 419 'class' => 'widefat', 420 'label' => __( 'From Email Address ', 'wp-user-control' ), 421 'field' => 'mailFromAddress', 422 'type' => 'text', 423 'value' => $instance['mailFromAddress'] 424 ) ); 425 // output custom email address field 426 $this->outputFormField( array( 427 'class' => 'widefat', 428 'label' => __( 'From Name ', 'wp-user-control' ), 429 'field' => 'mailFromName', 430 'type' => 'text', 431 'value' => $instance['mailFromName'] 432 ) ); 366 433 } 367 434 … … 392 459 $instance['loginTabLabel'] = trim( strip_tags( $new_instance['loginTabLabel'] ) ); 393 460 $this->OPTIONS[$this->number]['loginTabLabel'] = $instance['loginTabLabel']; 461 $instance['mailFromAddress'] = trim( strip_tags( $new_instance['mailFromAddress'] ) ); 462 $this->OPTIONS[$this->number]['mailFromAddress'] = $instance['mailFromAddress']; 463 $instance['mailFromName'] = trim( strip_tags( $new_instance['mailFromName'] ) ); 464 $this->OPTIONS[$this->number]['mailFromName'] = $instance['mailFromName']; 394 465 $instance['registerButtonLabel'] = trim( strip_tags( $new_instance['registerButtonLabel'] ) ); 395 466 $this->OPTIONS[$this->number]['registerButtonLabel'] = $instance['registerButtonLabel']; … … 602 673 // create password reset email message 603 674 $message = __('Someone has asked to reset the password for the following site and username.', 'wp-user-control' ) . "\r\n\r\n"; 604 $message .= get_option( 'siteurl' ) . "\r\n\r\n"; 675 $message .= network_site_url() . "\r\n\r\n"; 676 // $message .= get_option( 'siteurl' ) . "\r\n\r\n"; 605 677 $message .= sprintf( __( 'Username: %s', 'wp-user-control' ), $reset_user_login ) . "\r\n\r\n"; 606 $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.', 'wp-user-control' ) . "\r\n\r\n"; 607 $message .= get_option( 'siteurl' ) . "/wp-login.php?action=rp&key=$key\r\n"; 678 $message .= __( 'To reset your password visit the following address, otherwise just ignore this email and nothing will happen.', 'wp-user-control' ) . "\r\n\r\n"; 679 $message .= network_site_url( "wp-login.php?action=rp&key=" . rawurlencode( $key ) . "&login=" . rawurlencode( $reset_user_login ), 'login' ) . "\r\n"; 680 // $message .= get_option( 'siteurl' ) . "/wp-login.php?action=rp&key=$key\r\n"; 608 681 // send password reset email meassage 609 682 if ( false == wp_mail( $reset_user_email, sprintf( __( '[%s] Password Reset', 'wp-user-control' ), get_option( 'blogname' ) ), $message ) ) { -
wp-user-control/trunk/readme.txt
r519866 r522736 5 5 Requires at least: 2.9 6 6 Tested up to: 3.3.1 7 Stable tag: 1. 37 Stable tag: 1.4 8 8 9 9 Add a WordPress login widget that allows a user to login, register, or reset their password, ALL without leaving their current location! … … 23 23 <strong>Customization Features</strong> 24 24 <ul> 25 <li> Enables redirect to custom login URL for standard login</li>26 <li> Customizable tab labels (login, register, and reset)</li>27 <li>Customiz ablebutton labels (login, register, and reset)</li>25 <li>Customize sender name and email address in WP admin emails</li> 26 <li>Redirect to custom URL for login</li> 27 <li>Customize tab & button labels (login, register, and reset)</li> 28 28 <li>Toggle Avatar display</li> 29 <li> Choose default tab for display(login, register, or reset)</li>30 <li>Add a custom link for logged in users after <em>Profile</em> or <em>Admin</em> links</li>29 <li>Set default tab (login, register, or reset)</li> 30 <li>Add custom link for logged in users after <em>Profile</em> or <em>Admin</em> link</li> 31 31 <li>Internationalized and ready for language translation</li> 32 32 </ul> … … 56 56 Yes, using this setting will affect all logins for the site. Make ABSOLUTELY CERTAIN you are entering a valid URL before saving, or it could cause you problems getting into your site. 57 57 58 = Does the custom sender name and email address affect all administrative emails from my site? = 59 60 Yes, this setting will take effect for all administrative emails sent from your site. Leave these fields blank to use the default WordPress settings. 61 58 62 == Screenshots == 59 63 … … 68 72 69 73 == Changelog == 74 75 = 1.4 = 76 * Fixed bug with "invalid key" in links in password reset emails. 77 * Added ability to customize sender name and email address in WP admin emails (registration, reset, etc.). 70 78 71 79 = 1.3 = … … 98 106 == Upgrade Notice == 99 107 108 = 1.4 = 109 * IMPORTANT: Fixed bug with "invalid key" in links in password reset emails, also added ability to customize sender name and address in WP admin emails. 110 100 111 = 1.3 = 101 112 * Minor bug fixes, added Finnish language translation file. -
wp-user-control/trunk/wp_uc_widget.php
r519866 r522736 5 5 Plugin Name: WP User Control 6 6 Plugin URI: http://oaktondata.com/wp-user-control/ 7 Version: 1. 37 Version: 1.4 8 8 Author: Bill Edgar 9 9 Author URI: http://oaktondata.com … … 43 43 44 44 // define constants 45 define( 'WP_USER_CONTROL_WIDGET_VERSION', '1. 3' );45 define( 'WP_USER_CONTROL_WIDGET_VERSION', '1.4' ); 46 46 define( 'WP_USER_CONTROL_WIDGET_BASE_URL', network_site_url() ); 47 47 … … 163 163 164 164 remove_filter( 165 $tag = 'password_reset_message',166 $function_to_remove = 'wp_user_control_password_reset_email',167 $priority = 10,168 $accepted_args = 2169 ); // remove filter for password reset message170 171 remove_filter(172 $tag = 'retrieve_password_message',173 $function_to_remove = 'wp_user_control_retrieve_password_email',174 $priority = 10,175 $accepted_args = 2176 ); // remove filter for retrieve password message177 178 remove_filter(179 165 $tag = 'registration_errors', 180 166 $function_to_remove = 'wp_user_control_registration_errors_filter', … … 189 175 $accepted_args = 2 190 176 ); // remove filter for custom login url 177 178 remove_filter( 179 $tag = 'wp_mail_from', 180 $function_to_remove = 'wp_user_control_mail_from_filter', 181 $priority = 10, 182 $accepted_args = 1 183 ); // remove filter for custom mail from address 184 185 remove_filter( 186 $tag = 'wp_mail_from_name', 187 $function_to_remove = 'wp_user_control_mail_from_name_filter', 188 $priority = 10, 189 $accepted_args = 1 190 ); // remove filter for custom mail from name 191 191 192 192 }
Note: See TracChangeset
for help on using the changeset viewer.