gform_disable_registration

gform_disable_registration

DescriptionUsageParametersExamplesSource Code

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.
1add_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.
123456789101112131415add_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
1$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.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注