From 0975bdd41aab4722f6dc9cc9f14cd497b1b829df Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Mon, 3 Feb 2014 16:33:39 -0200 Subject: [PATCH] remove annonymous function to preserve php 5.2 compatibility --- social-connect.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/social-connect.php b/social-connect.php index 825d936..2e79e18 100644 --- a/social-connect.php +++ b/social-connect.php @@ -226,12 +226,7 @@ function sc_social_connect_process_login( $is_ajax = false ) { update_user_meta( $user_id, $sc_provider_identity_key, $sc_provider_identity ); } } else { - add_filter( 'wp_login_errors', function ( $errors ) { - $errors->errors = array(); - $errors->add( 'registration_disabled', __( 'ERROR: Registration is disabled.', 'social-connect' ) ); - - return $errors; - }); + add_filter( 'wp_login_errors', 'sc_login_errors' ); return; } @@ -250,6 +245,20 @@ function sc_social_connect_process_login( $is_ajax = false ) { exit(); } +/** + * Add error message when user try to login + * with an nonexistent e-mail and registration is disabled + * + * @param WP_Error $errors + * @return WP_Error + */ +function sc_login_errors( $errors ) { + $errors->errors = array(); + $errors->add( 'registration_disabled', __( 'ERROR: Registration is disabled.', 'social-connect' ) ); + + return $errors; +} + function sc_get_unique_username($user_login, $c = 1) { if ( username_exists( $user_login ) ) { if ($c > 5)