Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
illustrates how to set up the record edit shortcode based on the current user
* this code assumes that there is some value in the participant's record that
* determines what groups they will have access to
$pid = filter_input( INPUT_GET, 'pid', FILTER_SANITIZE_STRING );
$id = Participants_Db::get_participant_id( $pid );
if ( $id ) :
$user_record = Participants_Db::get_participant( $id );
// change this to use whatever value it is you need to determine what groups to show
// we are using 'student' and 'teacher' as examples of types of participant
switch ( $user_record['type'] ) {
case 'student':
$groups = 'main,address,student_info';
case 'teacher':
$groups = 'main,address,teacher_info';
// now show the record edit form for the current participant:
echo do_shortcode( '[pdb_record record_id=' . $id . ' groups=' . $groups . ']' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment