diff --git a/upload/oa-social-login/includes/admin.php b/upload/oa-social-login/includes/admin.php index 596c0d4..cc4231b 100755 --- a/upload/oa-social-login/includes/admin.php +++ b/upload/oa-social-login/includes/admin.php @@ -597,7 +597,10 @@ function oa_social_login_settings_validate ($settings) 'plugin_shortcode_login_redirect_url', 'plugin_shortcode_register_redirect', 'plugin_shortcode_register_redirect_url', - 'plugin_notify_admin' + 'plugin_notify_admin', + 'plugin_error_admin_address', + 'plugin_error_message_fr', + 'plugin_error_message_de' ) AS $key) { if (isset ($settings [$key])) @@ -1510,6 +1513,54 @@ function oa_display_social_login_settings () + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+

diff --git a/upload/oa-social-login/includes/user_interface.php b/upload/oa-social-login/includes/user_interface.php index 63aa240..f2e434c 100755 --- a/upload/oa-social-login/includes/user_interface.php +++ b/upload/oa-social-login/includes/user_interface.php @@ -90,6 +90,8 @@ function oa_social_login_render_link_form ($source, $user) { //Store the data being returned. $output = ''; + $errorOccured = false; + $errorCode = 0; if (is_object ($user) AND property_exists ($user, 'data') AND !empty ($user->data->ID)) { @@ -308,10 +310,23 @@ function oa_social_login_render_link_form ($source, $user) $error_message = __ ('This social network account is already used by another user.', 'oa-social-login'); } } + } else { + $errorOccured = true; + $errorCode = 1; } + } else { + $errorOccured = true; + $errorCode = 2; } + } else { + $errorOccured = true; + $errorCode = 4; } - } + } /*else { + // User button should be shown + /*$errorOccured = true; + $errorCode = 5; + }*/ //Button Theme $theme_id = (array_key_exists ('plugin_icon_theme', $settings) ? $settings['plugin_icon_theme'] : null); @@ -376,9 +391,35 @@ function oa_social_login_render_link_form ($source, $user) $output .= '' . $social_link . ''; $output .= ''; } + } else { + $errorOccured = true; + $errorCode = 6; } + } else { + $errorOccured = true; + $errorCode = 7; } + } else { + $errorOccured = true; + $errorCode = 8; + } + } else { + $errorOccured = true; + $errorCode = 9; + } + + if($errorOccured){ + $settings = get_option('oa_social_login_settings'); + $locale = get_locale(); + if(substr($locale, 0, 2) == 'fr'){ + $output = sprintf("

%s

", $settings['plugin_error_message_fr']); + } else { + $output = sprintf("

%s

", $settings['plugin_error_message_de']); } + $emailSubject = sprintf("ErrorCode %d: An Error Occured while linking a Social User", $errorCode); + $emailText = sprintf("ErrorCode: %d
Wordpressuser-ID: %d", $errorCode, get_current_user_id()); + $headers = array('Content-Type: text/html; charset=UTF-8'); + wp_mail($settings['plugin_error_admin_address'], $emailSubject, $emailText, $headers); } return $output; }