Skip to content

Instantly share code, notes, and snippets.

@xnau
Created April 2, 2019 22:47
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/0b02d0a71e3029fcb5d7c893be621671 to your computer and use it in GitHub Desktop.
Save xnau/0b02d0a71e3029fcb5d7c893be621671 to your computer and use it in GitHub Desktop.
Shows how to display a single Participants Database record for a logged-in WordPress user.
<?php
// this is meant to be used with some kind of plugin that lets you insert php into a page
//
// the Participants Database field named 'user_login' is expected to have the user's user login value
//
$current_user = wp_get_current_user();
if ( $current_user->ID ) {
$record_id = Participants_Db::get_record_id_by_term('user_login', $current_user->user_login );
echo do_shortcode( '[pdb_single record_id=' . $record_id . ']' );
} else {
echo 'You must log in to see your record';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment