• Resolved Brian KD

    (@brian-kd)


    I would like to use this plugin to hide everything in a div when members are not logged in. Is there an easy way to do this?

    I’ve tried to use the [wp-members status=”in”][/wp-members]. I also tried to use some javascript to hide a div when another div is not present, but my javascript wasn’t valid or perhaps the “inline-javascript” plugin I tried to use is bogus.

    Is it possible? Thanks,

    -Brian Peterson

    https://www.ads-software.com/extend/plugins/wp-members/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    I assume since it is a div you are hiding, this is in the template, not the content? If that’s the case, you can’t use a shortcode.

    You can use is_user_logged_in().

    <?php if( is_user_logged_in() ) { ?>
    
    <div>my content</div>
    
    <?php } ?>
    Thread Starter Brian KD

    (@brian-kd)

    The content is being generated in a plugin. I may still be able to use the shortcode by inserting it into the plugin’s output (seems logical enough). I’ve contacted the other plugin author for assistance. It’s a B&B website and we don’t want people to be able to book unless they’re a registered member. Your code snippet may be all we need. Thanks,

    -Brian Peterson

    Plugin Author Chad Butler

    (@cbutlerjr)

    That’s actually not as logical as you might think. It depends on when that plugin’s output is being handled (which would depend on various actions/filter hooks that it might be using). The WordPress shortcode parser fires only once, so if the plugin is firing after that, the shortcode wouldn’t be parsed.

    Thread Starter Brian KD

    (@brian-kd)

    That’s interesting that the parser fires only once and probably explains my experiences. I attempted a few insertions of the shortcode tags but each time they were printed out as a string. Fortunately for me the other plugin author said he was implementing what I needed in his next update in 2 weeks so this issue will be resolved then. Thanks Chad,

    -Brian

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP-Members] Hide a div when users not logged in?’ is closed to new replies.