Skip to content

Instantly share code, notes, and snippets.

@xnau
Created December 21, 2019 01:52
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 xnau/22a3b0f4314ae61f2726fec1198eb81c to your computer and use it in GitHub Desktop.
Save xnau/22a3b0f4314ae61f2726fec1198eb81c to your computer and use it in GitHub Desktop.
Shows how to set the readonly status of a Participants Database field based on the field data
<?php
// set the first_name field to read only
add_filter( 'pdb-before_field_added_to_iterator', function ($field) {
/** @var PDb_Field_Item $field */
if ( $field->name() === 'first_name' ) {
$field->make_readonly();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment