Advertisement
Guest User

Untitled

a guest
May 29th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. // Do not copy opening php tag
  3.  
  4.  
  5. function bb_auth_reply_view( $reply_id ) {
  6. $reply_id = bbp_get_reply_id( $reply_id );
  7.  
  8. // Check if password is required
  9. if ( post_password_required( $reply_id ) )
  10. return get_the_password_form();
  11.  
  12. $content = get_post_field( 'post_content', $reply_id );
  13.  
  14. // first topic reply shouldn't be hiding
  15. $rep_position = bbp_get_reply_position($reply_id);
  16.  
  17. // if user is not logged in and not the first post topic
  18. if( !is_user_logged_in() && $rep_position > 1 ) {
  19. return "Replies only viewable for logged in users";
  20. } else {
  21. // return normal
  22. return $content;
  23. }
  24. }
  25. add_filter( 'bbp_get_reply_content', 'bb_auth_reply_view' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement