Error: Empty role.', 'bbpress' ) ); } // Add error if posted role is not a valid role if ( ! bbp_is_valid_role( $to_validate ) ) { bbp_add_error( 'bbp_signup_role_invalid', __( 'Error: Invalid role.', 'bbpress' ) ); } // If no errors, set return value to the role to validate if ( ! bbp_has_errors() ) { $retval = $to_validate; } // Filter & return return (string) apply_filters( 'bbp_validate_signup_role', $retval, $to_validate ); } /** * Validate the Forum role during the registration process * * @since 2.6.5 * * @param string $to_validate A well-formed (string) role ID to validate * @return string A valid role ID, or empty string on error */ function bbp_validate_registration_role( $to_validate = '' ) { // Default return value $retval = bbp_get_default_role(); // Conditionally handle posted values for capable users if ( is_admin() && current_user_can( 'create_users' ) ) { $retval = $to_validate; } // Validate & return return bbp_validate_signup_role( $retval ); } /** * Validate the Forum role during activation * * This function exists simply for parity with registrations, and to maintain an * intentional layer of abstraction from the more generic function it uses. * * @since 2.6.5 * * @param string $to_validate A well-formed (string) role ID to validate * @return string A valid role ID, or empty string on error */ function bbp_validate_activation_role( $to_validate = '' ) { // Validate & return return bbp_validate_signup_role( $to_validate ); }