Created
April 2, 2019 22:47
-
-
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.
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 | |
// 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