I was knocking up the minutes for the last meeting, and as I was recording the names of the attendees, realised that sharing that information to the world is neither necessary nor helpful.

I’ve used a bit of php from this post by Justin Tadlock to create a shortcode Members Only Stuff Here - Log in to see it. that will hide anything between it so that only logged in users are able to see/read it.

So, to hide the attendees list (or anything else we want to hide on this site, surround it with Members Only Stuff Here - Log in to see it..

This had to be added to our current theme’s core functions.php file – so when we update, we have to make sure we add the code again, else everything hidden will become visible once more.

Here’s the code itself;

add_shortcode( 'member', 'member_check_shortcode' );

function member_check_shortcode( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
return $content;
return '';

Thanks to Justin Tadlock: http://justintadlock.com/archives/2009/05/09/using-shortcodes-to-show-members-only-content