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 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 accept admin-area posted values for capable users. This is * to allow for Site/Network Admins to assign a default role when inviting * or creating a new User account. */ if ( is_admin() && current_user_can( 'create_users' ) ) { $retval = $to_validate; } // Validate & return return bbp_validate_signup_role( $retval ); } /** * Validate the Forum role during multisite activation * * This function exists simply for parity with registrations, and to maintain an * intentional layer of abstraction from the more generic function it uses. * * Note: this will not fire inside of wp-activate.php unless it is hooked in * during sunrise.php, and is considered an advanced use-case. * * @since 2.6.5 * * @param string $to_validate A 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 ); }