Skip to content

Commit

Permalink
remove annonymous function to preserve php 5.2 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoprimo committed Feb 3, 2014
1 parent be6a956 commit 0975bdd
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions social-connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', __( '<strong>ERROR</strong>: Registration is disabled.', 'social-connect' ) );

return $errors;
});
add_filter( 'wp_login_errors', 'sc_login_errors' );

return;
}
Expand All @@ -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', __( '<strong>ERROR</strong>: Registration is disabled.', 'social-connect' ) );

return $errors;
}

function sc_get_unique_username($user_login, $c = 1) {
if ( username_exists( $user_login ) ) {
if ($c > 5)
Expand Down

0 comments on commit 0975bdd

Please sign in to comment.