Conditional content in cells using PHP in table extension
-
Hey,
Thanks for the plugin, loving it so far. I’m having some issues with the PHP in Tables extension. I’ve tried two different ways of implementing PHP in the cell and I get 2 different results, neither are the desired. I’m using it with the Simple WordPress Membership plugin.
This code doesn’t show the conditional content when the user is logged in to the plugin.
<?php if(SwpmMemberUtils::is_member_logged_in()) : ?> <b>DANTE’S CORNER</b> <a href="http://somebodyelsesmoney.com/demo/dantes-corner-subscriber/"><img src="http://somebodyelsesmoney.com/demo/wp-content/uploads/2016/10/Dantes.png" alt="dantes" width="117px" height="132px" class="alignleftsize-full wp-image-152" <a href="http://somebodyelsesmoney.com/demo/dantes-corner/"><a/> <?php else : ?> <b>DANTE’S CORNER</b> <a href="http://somebodyelsesmoney.com/demo/dantes-corner"><img src="http://somebodyelsesmoney.com/demo/wp-content/uploads/2016/10/Dantes.png" alt="dantes" width="117px" height="132px" class="alignleftsize-full wp-image-152" <a href="http://somebodyelsesmoney.com/demo/dantes-corner/"><a/> <?php endif; ?>This one does show the conditional content but it shows it whether or not the user is logged into the plugin.
<?php if(SwpmMemberUtils::is_member_logged_in()){ echo ' <b>DANTE’S CORNER</b> <a href="http://somebodyelsesmoney.com/demo/dantes-corner-subscriber/"><img src="http://somebodyelsesmoney.com/demo/wp-content/uploads/2016/10/Dantes.png" alt="dantes" width="117px" height="132px" class="alignleftsize-full wp-image-152" <a href="http://somebodyelsesmoney.com/demo/dantes-corner/"><a/> '; }else{ echo ' <b>DANTE’S CORNER</b> <a href="http://somebodyelsesmoney.com/demo/dantes-corner"><img src="http://somebodyelsesmoney.com/demo/wp-content/uploads/2016/10/Dantes.png" alt="dantes" width="117px" height="132px" class="alignleftsize-full wp-image-152" <a href="http://somebodyelsesmoney.com/demo/dantes-corner/"><a/>'; } ?>I need it so that if a user is logged in through the plugin, the subscriber link shows up in the table. If not, the regular link. I know the
if(SwpmMemberUtils::is_member_logged_in())is working because it works for other parts of the site.Thanks in advance.
The topic ‘Conditional content in cells using PHP in table extension’ is closed to new replies.