Last active
October 28, 2017 20:46
-
-
Save xnau/53de66190ec8430d87cc9e06acf310f7 to your computer and use it in GitHub Desktop.
Demonstrates how to alter a specific access capability in Participants Database
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 | |
add_filter( 'pdb-access_capability', 'set_pdb_access_controls', 10, 2 ); | |
/* | |
* @param string $cap the current capability level that gives access to the function named in $context | |
* @param string $context the specific action that is being tested | |
* @return string the capability that is allowed to access the function named in $context | |
*/ | |
function set_pdb_access_controls( $cap, $context ) | |
{ | |
// set the access capability for a specific action | |
switch ( $context ) { | |
case 'delete participants': | |
$cap = 'edit_others_posts'; // typical cap for WP Editors | |
break; | |
} | |
return $cap; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment