Maybe I misunderstand what you are doing, and I apologize if that is the case, but…
- It looks like you are returning content if the post DOES NOT already
have one, which looks backward to me based on my understanding of
your problem. - It looks like you are trying to execute a broken
(incomplete) shortcode.
I misunderstood the original question but based on comments below, you need to run do_shortcode()
on the whole content block, not just on the closing section.
I think your code should look like:
add_filter( 'the_content', 'closing_shortcode' );
function closing_shortcode( $content ) {
// return if the shortcode has already been added
// Note the ! was removed
if( has_shortcode( $content, 'members') )
return $content;
// Add the closing sortcode tag
$close_shortcode="[/member]";
// and run do_shortcode() on the whole content block
return do_shortcode($content . $close_shortcode);
}
If that doesn’t work, it will take some manipulation of the core content and shortcode execution systems and I will have to tackle later, when I have more time.