Title: PHP Shortcode for Groups Doesn&#039;t work?
Last modified: August 22, 2016

---

# PHP Shortcode for Groups Doesn't work?

 *  Resolved [sanji41](https://wordpress.org/support/users/sanji41/)
 * (@sanji41)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/php-shortcode-for-groups-doesnt-work/)
 * Hi,
 * I have a theme that kinda needed a PHP shortcode to hide several divs from the
   user. Thing is, when I use `<?php echo do_shortcode('[groups_member group="cookbook"]');?
   >` It doesn’t work, the end shortcode shows and the text that should be hidden
   isn’t. I know this isn’t normal, but I wanted to know if the plugin is capable
   of using the PHP shortcode or not? Or there’s something wrong with the theme?
 * Theme Name: Food And Cook
    WP: 4.0
 * Cheers
 * [https://wordpress.org/plugins/groups/](https://wordpress.org/plugins/groups/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Anonymous User 9906592
 * (@anonymized-9906592)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/php-shortcode-for-groups-doesnt-work/#post-5412827)
 * I’m curious about this as well. I can get the shortcodes to display group-specific
   content just fine via the editor, but when it comes to doing “do_shortcode()”
   calls actually_ in the php_, I’ve had zero luck. For example, this does not work:
 *     ```
       <?php echo do_shortcode('[groups_non_member group="Registered"]') ?>
       //put content
       <?php echo do_shortcode('[/groups_non_member]') ?>
       ```
   
 * Being able to do this would be incredibly useful.
 *  Plugin Author [itthinx](https://wordpress.org/support/users/itthinx/)
 * (@itthinx)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/php-shortcode-for-groups-doesnt-work/#post-5412829)
 * I can imagine that the problem is the whole thing has to be within one call. 
   Try:
 *     ```
       $content = '[groups_member group="Registered"]';
       $content .= 'Only registered users should be able to see this.';
       $content .= '[/groups_member]';
       echo do_shortcode( $content );
       ```
   
 *  [kofiler](https://wordpress.org/support/users/kofiler/)
 * (@kofiler)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/php-shortcode-for-groups-doesnt-work/#post-5412830)
 * Works perfect, maybe will be very useful if you can provide other users who don’t
   know PHP (like me) tutorial to do something like:
 * <?php
    $content = ‘[groups_member group=”Registered”]’; $content .= ‘<?php echo?
   >’; $content .= ‘[/groups_member]’; echo do_shortcode( $content ); ?>

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘PHP Shortcode for Groups Doesn't work?’ is closed to new replies.

 * ![](https://ps.w.org/groups/assets/icon-256x256.png?rev=983146)
 * [Groups](https://wordpress.org/plugins/groups/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/groups/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/groups/)
 * [Active Topics](https://wordpress.org/support/plugin/groups/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/groups/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/groups/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 3 replies
 * 4 participants
 * Last reply from: [kofiler](https://wordpress.org/support/users/kofiler/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/php-shortcode-for-groups-doesnt-work/#post-5412830)
 * Status: resolved