Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save New0/f9c3aaad364fdc9d6bf4af117f55597c to your computer and use it in GitHub Desktop.
Save New0/f9c3aaad364fdc9d6bf4af117f55597c to your computer and use it in GitHub Desktop.
Code examples for caldera_forms_api_allow_entry_view filter to change who can see Caldera Forms front-end entry viewer and corresponding REST API endpoint
<?php
/**
* Allow all requests to read entries of form with ID CF123567
*
* For API endpoint that powers front-end entry viewer.
*/
add_filter( 'caldera_forms_api_allow_entry_view', function( $allowed, $form_id, WP_REST_Request $request ){
if( 'CF123567' === $form_id ){
return true;
}
return $allowed;
}, 10, 3 );
<?php
/**
* Custom auth for requests to read entries of form with ID CF123567
*
* For API endpoint that powers front-end entry viewer.
*/
add_filter( 'caldera_forms_api_allow_entry_view', function( $allowed, $form_id, WP_REST_Request $request ){
if( 'CF123567' === $form_id ){
//Create your own system for checking authorization, using current request.
$allowed = some_custom_auth_function( $request );
}
return $allowed;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment