Created
October 14, 2017 18:41
-
-
Save xnau/a8754b6cd5bb724a03780ab7885fd736 to your computer and use it in GitHub Desktop.
shows how to use the "approved" field in a Participants Database record to prevent a record from being edited
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 | |
// if the record is not approved, they cannot edit the record. | |
// you can easily adapt this to any other checkbox field so you can use that field to prevent editing | |
add_filter( 'pdb-check_submission', function() { | |
if ( !is_admin() && $_POST['action'] === 'update' ) { | |
$record = Participants_Db::get_participant( $_POST['id']); | |
// if the field has a value of "yes" allow editing | |
// if it is any other value, editing will not be allowed | |
return $record['approved'] === 'yes'; | |
} | |
return true; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment