Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

  • baldgoat
    Participant

    @baldgoat

    Done and done.


    baldgoat
    Participant

    @baldgoat

    Thanks ticket has been opened.

    For anyone interested, here’s the filter I added to my functions file…

    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;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar