Last active
March 11, 2025 11:43
-
-
Save xnau/cc853f90967a19377b58a37a3d7dad52 to your computer and use it in GitHub Desktop.
Shows how to filter a Participants Database list display based on data from the user's Participants Database record
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 | |
/** | |
* list of records based on the user's data | |
* | |
* the name of the user's group is in a field named group_membership | |
* when they open the page, the list shortcode is filtered to only show members of the same group | |
* | |
*/ | |
if ( is_user_logged_in() ) : | |
$profileuser = new \pdbwpu\users_record(); | |
$users_group = $profileuser->pdb_record()['group_membership']; | |
$filter = 'group_membership=' . $users_group; | |
echo do_shortcode( '[pdb_list filter="' . $filter . '"]' ); | |
else: | |
?> | |
<p>You must be logged in to view this list</p> | |
<?php | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to enable Combo Multisearch on [pbd_list template=userfilter]
Help me!!