login | register
Sun 14 of Mar, 2010 (14:09 UTC)

bitweaver - Web Application Framework and CMS

Web Application Framework and CMS

     
Get RSS Feed

Hide Comments from Anon

Chris Preston
Joined: 01 Dec 2009
Reply to this PostReply with Quote to this Post

Hide Comments from Anon

Posted:Tue 01 of Dec, 2009 (16:57 UTC)
I am trying to allow all anonymous visitors access to the wiki, but not show the comments unless logged in. I have tried unchecked read comments, but does not seem to hide them. Any ideas?
Lester Caine
Joined: 24 Apr 2004
Reply to this PostReply with Quote to this Post

Re: Hide Comments from Anon

Posted:Fri 04 of Dec, 2009 (20:29 UTC)
users -> Permission Management -> p_liberty_read_comments Move the tick to registered ....
Chris Preston
Joined: 01 Dec 2009
Reply to this PostReply with Quote to this Post

Re: Hide Comments from Anon

Posted:Mon 07 of Dec, 2009 (18:11 UTC)
I have tried this, even shifting it all the way to only admins can read comments, but nothing seems to change. Any ideas?
Chris Preston
Joined: 01 Dec 2009
Reply to this PostReply with Quote to this Post

Re: Hide Comments from Anon

Posted:Mon 07 of Dec, 2009 (18:51 UTC)
While far from a perfect solution; I have fixed this. Editing: bitweaver / wiki / display_bitpage_inc.php

Original

  1. // Comments engine!
  2. if( $gBitSystem->isFeatureActive( 'wiki_comments' )) {
  3. $comments_vars = array( 'page' );
  4. $comments_prefix_var = 'wiki page:';
  5. $comments_object_var = 'page';
  6. $commentsParentId = $gContent->mContentId;
  7. $comments_return_url = WIKI_PKG_URL.'index.php?page_id='.$gContent->mPageId;
  8. # Support displaying comments on their own page instead of on content page
  9. if( isset( $_REQUEST["comments_page"] ) && ( $_REQUEST["comments_page"] == '1' ) || !empty( $_REQUEST['view_comment_id'] )) {
  10. $gBitSmarty->assign( 'comments_page', 1 );
  11. $comments_on_separate_page = 1;
  12. $comments_return_url = WIKI_PKG_URL.'index.php?page_id='.$gContent->mPageId.'&comments_page=1';
  13. if ( !empty($_REQUEST['view_comment_id']) ) {
  14. $comments_return_url .= '&comments_maxComments=1';
  15. }
  16. }
  17. include_once( LIBERTY_PKG_PATH.'comments_inc.php' );
  18. }

Modified

  1. // Comments engine!
  2. if( $gBitUser->hasPermission( 'p_liberty_read_comments' ) ) {
  3. if( $gBitSystem->isFeatureActive( 'wiki_comments' )) {
  4. $comments_vars = array( 'page' );
  5. $comments_prefix_var = 'wiki page:';
  6. $comments_object_var = 'page';
  7. $commentsParentId = $gContent->mContentId;
  8. $comments_return_url = WIKI_PKG_URL.'index.php?page_id='.$gContent->mPageId;
  9. # Support displaying comments on their own page instead of on content page
  10. if( isset( $_REQUEST["comments_page"] ) && ( $_REQUEST["comments_page"] == '1' ) || !empty( $_REQUEST['view_comment_id'] )) {
  11. $gBitSmarty->assign( 'comments_page', 1 );
  12. $comments_on_separate_page = 1;
  13. $comments_return_url = WIKI_PKG_URL.'index.php?page_id='.$gContent->mPageId.'&comments_page=1';
  14. if ( !empty($_REQUEST['view_comment_id']) ) {
  15. $comments_return_url .= '&comments_maxComments=1';
  16. }
  17. }
  18. include_once( LIBERTY_PKG_PATH.'comments_inc.php' );
  19. }
  20. }
This works but leaves a blank Comments title for anon users.
Lester Caine
Joined: 24 Apr 2004
Reply to this PostReply with Quote to this Post

Re: Hide Comments from Anon

Posted:Thu 10 of Dec, 2009 (12:59 UTC)
I'd missed that Chris - I actually have comments off on the wiki pages ;) I'll tidy it up in CVS - Only need the one 'if' and AND the permissions.