By Kyle Champ on Thursday, 23 July 2015
Posted in General Issues
Likes 0
Views 847
Votes 0
I would like to have it where guests / public users can see the questions but can't see the answers / reply's unless they are logged in. Searching the forums I found this http://stackideas.com/forums/log-in-to-see-answers which seems to be addressing the same question. The issue for me is I'm not 100% sure what the answer means.

Unfortunately there's no such settings currently but I have added some tweaks in the file /components/com_easydiscuss/themes/simplistic/post.php at line 57,


	<?php if ($system->my->guest) { ?>

<?php } else { ?>
<?php if( $answer ){ ?>
<div class="discuss-answer discussAnswer">
<a name="answer"></a>
<?php echo $this->loadTemplate( 'post.reply.item.php' , array( 'question' => $post, 'post' => $answer ) ); ?>
</div>
<?php } ?>
<?php } ?>



You just need to fill in the first "if" statement with your html codes for guests.


The part I don't understand is the last part"You just need to fill in the first "if" statement with your html codes for guests". Can anyone be a little more descriptive of what exactly I need to put here please.

Thanks so much
Hello Kyle,

Please replace with the attached file.
·
Friday, 24 July 2015 11:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Kyle,

In other words, you need to place your HTML codes at line 2 after the block of codes below:


<?php if ($system->my->guest) { ?>
Whatever you want to display to guests here.
<?php } ?>
·
Thursday, 23 July 2015 23:40
·
0 Likes
·
0 Votes
·
0 Comments
·
Right and I've tried exactly that but what happens is you are still able to see the answer when not logged into the site and the wording added just shows up also. See attachment and look in the middle for the "Whatever you want to display to guests here."

Thank you,

Kyle
·
Friday, 24 July 2015 06:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Kyle,

Perhaps you can provide us with your modification file here so we can take a closer look on your code? Do not that we are giving less support priority for the modification request as you can see from our support policy here, http://stackideas.com/support . Hope you understand.
·
Friday, 24 July 2015 11:25
·
0 Likes
·
0 Votes
·
0 Comments
·
I fully understand and appreciate your help. I hoped it was an actual feature in the component itself as it's very common for sites to hide (answers) to the public and only allow it to registered users. I attached the post.php I am using. The only modification I made to it was adding in the.

<?php if ($system->my->guest) { ?>
Whatever you want to display to guests here.
<?php } ?>


Thanks again!!!
·
Friday, 24 July 2015 11:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you, that worked great.
·
Saturday, 25 July 2015 10:57
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome Kyle, glad that your issues are resolved now
·
Saturday, 25 July 2015 12:37
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post