Created
January 7, 2020 16:24
-
-
Save New0/0d9a7f2aaeb1615727ec7af7385b8db6 to your computer and use it in GitHub Desktop.
Allow a precise user to read form the caldera forms entry viewer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This will allow a user with ID 2 to view the entry viewer even without the manage_optiuons capability | |
* REPLACE 2 by the correct user ID | |
*/ | |
add_filter('caldera_forms_manage_cap', function( $cap, $context, $form ){ | |
if( is_user_logged_in() ){ | |
$user_id = get_current_user_id(); | |
if( $context === "entry-view" && $user_id === 2 ){ | |
$cap = "read"; | |
} | |
} | |
return $cap; | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment