gfpdf_shortcode_signing_user_id
Description
Outside Gravity Forms, a signed [gravitypdf] URL is only signed if a particular user can view the entry: the post's author in post content, otherwise the current user. Use this filter to change the user.
It doesn't apply in Gravity Forms confirmations and notifications or in PDFs, or when a merge tag sets the entry attribute. See When the Shortcode Signs the URL.
warning
If you return a user who can view every entry, anyone who can add the shortcode can get a signed URL to any entry on that PDF's form.
Version
This filter was introduced in Gravity PDF 6.18.0.
Parameters
$user_id | integer
- The user to check.
0if logged out and not in post content.
$entry_id | integer | string
- The entry ID from the shortcode's
entryattribute
$settings | array
- The PDF settings
Usage
Check user 1 for one PDF:
add_filter( 'gfpdf_shortcode_signing_user_id', function( $user_id, $entry_id, $settings ) {
return $settings['id'] === '560f2ef799945' ? 1 : $user_id;
}, 10, 3 );
Source Code
This filter is located in the Model_Shortcodes::can_sign_url() method of /src/Model/Model_Shortcodes.php.