rcp_hide_single_reply

The Restrict Content Pro - bbPress rcp hide single reply function.

Description

rcp_hide_single_reply(); 

Usage

  1. if ( !function_exists( 'rcp_hide_single_reply' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'restrict-content-pro-bbpress/includes/reply-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = rcp_hide_single_reply(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/reply-functions.php  
  1. function rcp_hide_single_reply() { 
  2.  
  3. $topic_id = get_the_ID(); 
  4. $post_type = get_post_type( $topic_id ); 
  5.  
  6. if( ! function_exists( 'bbp_get_topic_post_type' ) ) { 
  7.  
  8. return; 
  9.  
  10.  
  11. if ( bbp_get_topic_post_type() !== $post_type ) { 
  12. return; 
  13.  
  14. if ( rcp_bbp_can_access_topic( bbp_get_reply_topic_id() ) ) { 
  15. return; 
  16.  
  17. if( is_user_logged_in() ) { 
  18.  
  19. $redirect = home_url(); 
  20.  
  21. } else { 
  22.  
  23. $redirect = bbp_get_topic_permalink( bbp_get_reply_topic_id( $topic_id ) ); 
  24.  
  25.  
  26. wp_redirect( home_url( 'wp-login.php?redirect_to=' . urlencode( $redirect ) ) ); 
  27. exit; 
  28.