[buddypress-trac] [BuddyPress Trac] #6895: bp_core_validate_email_address doesn’t check signups table
buddypress-trac
noreply at wordpress.org
Thu Feb 11 22:28:16 UTC 2016
#6895: bp_core_validate_email_address doesn’t check signups table
--------------------------+------------------------------
Reporter: baldgoat | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: API | Version:
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------------
Comment (by baldgoat):
At the request of shanebp on the BuddyPress.org forums, here is a link to
our discussion...
https://buddypress.org/support/topic/bp_core_validate_email_address-
doesnt-check-signups-table/
And the filter I wrote to resolve the issue...
{{{
add_filter('bp_core_validate_user_signup', 'check_signups_for_dup');
function check_signups_for_dup($arrResult)
{
//If errors already exist just send it back
if (!empty($arrResult['errors']->errors['user_name']) ||
!empty($arrResult['errors']->errors['user_email'])) {
return $arrResult;
}
global $wpdb;
$strUsernameQry = "SELECT COUNT(*) FROM {$wpdb->prefix}signups WHERE
active='0' AND user_login = %s";
$strEmailQry = "SELECT COUNT(*) FROM {$wpdb->prefix}signups WHERE
active='0' AND user_email = %s";
$intUsernames = $wpdb->get_var($wpdb->prepare($strUsernameQry,
$arrResult['user_name']));
$intEmails = $wpdb->get_var($wpdb->prepare($strEmailQry,
$arrResult['user_email']));
if (!empty($intUsernames)) {
$arrResult['errors']->add('user_name', 'Sorry, a signup with that
username already exists');
}
if (!empty($intEmails)) {
$arrResult['errors']->add('user_email', 'Sorry, a signup with that
email already exists');
}
return $arrResult;
}
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6895#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list