gform_disable_registration

Description

The “gform_disable_registration” filter allows add-ons to prevent the User Registration add-on from registering/updating a user.

Usage

Applies to all forms.

add_filter( 'gform_disable_registration', 'your_function_name', 10, 3 );

Parameters

  • $is_disabled bool

    True or false.

  • $form Form Object

    The submitted form object.

  • $entry Entry Object

    The entry object from which the user was registered.

  • $fulfilled bool

    True or false. This may be a value passed from an add-on like PayPal which indicates that the payment has been fulfilled. Null as of version 3.0.

Examples

Below is an example which disables registration based on submitted form values.

add_filter( 'gform_disable_registration', 'disable_registration', 10, 3 );
function disable_registration( $is_disabled, $form, $entry ) {
    //check form id and if not the form being checked simply status passed in to function
    if ( $form['id'] != 160 ) {
        return $is_disabled;
    }

    //check submitted values to decide if registration should be stopped
    if ( rgar( $entry, '4' ) == 'No' && rgar( $entry, '5' ) == 'No' ) {
        //disable registration
        return true;
    } else {
        return false;
    }
}

Source Code

$disable_registration = apply_filters( 'gform_disable_registration', false, $form, $entry, null /* $fullfilled deprecated */ );

This filter is located in GF_User_Registration::process_feed() in class-gf-user-registration.php.