Recent Topics

Part of content password protected

Started by on Nov 28, 2017 – Contents updated: Nov 29, 2017

Nov 28, 2017 15:48    

I'm running the latest release.

I have posts that consist of a bunch of text and a code block. Everything works fine, however I'd like to only show the code block segment if the user is logged in. If they aren't logged in I just want the text displayed (no code block). I just started looking into this but after a quick look I didn't see a good way to do this.

Any guidance would be appreciated!

Nov 29, 2017 01:36

You could make a separate collection for the code which is members only with links from the text posts

or

you could hack the skin single post files:
1.Give the code in the posts a div with an id id="DivCo"
2.via css make the div invisible #DivCo {visibility:none}
3.add code to the skin page that only shows the Div when logged in with something like this after the post
<?php


skin_include( '_item_content.inc.php', array(
'image_size' => 'fit-540x405',
) );

if (isset($current_User))
?>
<style type="text/css">
#DivCo {visibility:visible;}
</style>
<?php
}
?>

Nov 29, 2017 01:43

the code above is a bit off. More proper syntax below

if (isset($current_User)) {
?>
<style type="text/css">
#DivCo {visibility:visible;}
</style>
<?php
}


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.