is_user_logged_in not working in plugin
-
i’m trying to set a link and/or div which only shows when a user is logged in, and another one when they are logged out. the <?php if( is_user_logged_in() command doesnt seem to work in this plugin, although it does work in other areas of my site and no conflicts show in console. can anyone help me solve the issue?
i’ve tried a number of variables, but here’s two versions i’ve tried recently (which didnt work)
<div> <?php if( is_user_logged_in() ){?> <a class="writearticle" style="-moz-box-shadow: inset 0px 1px 0px 0px #ffffff; -webkit-box-shadow: inset 0px 1px 0px 0px #ffffff; box-shadow: inset 0px 1px 0px 0px #ffffff; background-color: transparent; -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; border: 1px solid #dcdcdc; display: inline-block; cursor: pointer; color: #666666; font-family: Arial; font-size: 15px; font-weight: bold; padding: 6px 24px; text-decoration: none; text-shadow: 0px 1px 0px #ffffff;" href="https://news.focallocal.org/log-in">test</a> <?php } else { ?> <?php wp_loginout();?> <?php }?> </div> <div style="display: inline" *display:inline; zoom:1;><?php if ( !is_user_logged_in() ): ?> <a class="writearticle" style="-moz-box-shadow: inset 0px 1px 0px 0px #ffffff; -webkit-box-shadow: inset 0px 1px 0px 0px #ffffff; box-shadow: inset 0px 1px 0px 0px #ffffff; background-color: transparent; -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; border: 1px solid #dcdcdc; display: inline-block; cursor: pointer; color: #666666; font-family: Arial; font-size: 15px; font-weight: bold; padding: 6px 24px; text-decoration: none; text-shadow: 0px 1px 0px #ffffff;" href="https://news.focallocal.org/log-in">test</a> | <?php endif; ?> <?php wp_loginout(); ?> </div>
- The topic ‘is_user_logged_in not working in plugin’ is closed to new replies.