Skip to content

Instantly share code, notes, and snippets.

@xnau
Created February 28, 2024 18:15
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/307db68446303a235210ec469fe58dab to your computer and use it in GitHub Desktop.
Save xnau/307db68446303a235210ec469fe58dab to your computer and use it in GitHub Desktop.
Demonstrates a simple way to control the Participants Database list display based on the logged-in user
<?php
/**
* participants database list template that shows special content for logged-in users
*/
if ( is_user_logged_in() )
{
do_shortcode( '[pdb_list search=true template="edit-link"]' );
}
else
{
do_shortcode( '[pdb_list search=true]');
}
@xnau
Copy link
Author

xnau commented Feb 28, 2024

This is pretty straightforward, after checking on the user's logged-in status, you can determine which shortcode is used to display the list. The shortcode in the "do_shortcode" function can be anything you need it to be.

Be sure to read this article to understand where to place this file: Using Participants Database Custom Templates

Use this template by placing a shortcode like this on the page: [pdb_list template=usercontent]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment