Browse files

Make sure other email servers can save its settings. Fixes #19.

Previously, if a user inputted any other server not named GMail, it would wipe out the mail server settings for that server.
This was an error on my part.  Boo Ray.
  • Loading branch information...
1 parent d1ad634 commit 316a70aecd39efb2dd67955707872646a5982c9c @r-a-y committed Aug 28, 2012
Showing with 8 additions and 7 deletions.
  1. +8 −7 includes/bp-rbe-admin.php
View
15 includes/bp-rbe-admin.php
@@ -165,7 +165,7 @@ function validate( $input ) {
if ( !empty( $username ) ) {
$output['username'] = $username;
- if ( is_email( $username ) && $input['gmail'] == 1 )
+ if ( is_email( $username ) )
$output['email'] = $username;
}
@@ -181,17 +181,18 @@ function validate( $input ) {
$output['tag'] = $input['tag'];
// override certain settings if "gmail" setting is true
- if ( $input['gmail'] == 1 ) {
+ if ( ! empty( $input['gmail'] ) && $input['gmail'] == 1 ) {
$output['servername'] = 'imap.gmail.com';
$output['port'] = 993;
$output['tag'] = '+';
$output['gmail'] = 1;
}
- // if unchecked, reset these settings
- elseif ( $output['port'] || $output['servername'] || $output['tag'] ) {
- unset( $output['port'] );
- unset( $output['servername'] );
- unset( $output['tag'] );
+ // use alternate server settings as defined by the user
+ else {
+ $output['servername'] = wp_filter_nohtml_kses( $input['servername'] );
+ $output['port'] = absint( $input['port'] );
+ $output['tag'] = wp_filter_nohtml_kses( $input['tag'] );
+ $output['gmail'] = 0;
}
// check if key is alphanumeric

0 comments on commit 316a70a

Please sign in to comment.