gform_signature_url_require_login

Description

The gform_signature_url_require_login filter can be used to require the user be logged in before the signature URL will allow access to the file.

Usage

The following would apply to all forms.

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

Parameters

  • $require_login bool

    Does the user need to be logged in to access the signature? Default false.

  • $form_id int

    The ID of the form used to create the requested signature.

  • $field_id int

    The ID of the field used to create the requested signature.

Examples

1. Require login for all forms

add_filter( 'gform_signature_url_require_login', '__return_true' );

2. Require login for specific form and field

add_filter( 'gform_signature_url_require_login', 'require_login_for_signatures', 10, 3 );
function require_login_for_signatures( $require_login, $form_id, $field_id ){

  	// Update values below to match your form and field id's
	if  ( $form_id == '97' && $field_id == '2' ) {

		$require_login = true;
		
	}

	return $require_login;
}

Placement

This code should be placed in the functions.php file of your active theme or a custom functions plugin.

Since

This filter was added in version 4.0.

Source Code

This filter is located in GF_Signature_Image::maybe_require_login() in includes/class-gf-signature-image.php.