bbp_suppress_private_author_link

Replace forum author details for users that cannot view them.

Description

(string) bbp_suppress_private_author_link( (string) $author_link, (int) $args ); 

Returns (string)

Parameters (2)

0. $author_link (string)
The author link.
1. $args (int)
The args.

Usage

  1. if ( !function_exists( 'bbp_suppress_private_author_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/forums/template.php'; 
  3.  
  4. // The author link. 
  5. $author_link = ''; 
  6.  
  7. // The args. 
  8. $args = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_suppress_private_author_link($author_link, $args); 
  12.  

Defined (1)

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

/includes/forums/template.php  
  1. function bbp_suppress_private_author_link( $author_link, $args ) { 
  2.  
  3. // Assume the author link is the return value 
  4. $retval = $author_link; 
  5.  
  6. // Show the normal author link 
  7. if ( !empty( $args['post_id'] ) && !current_user_can( 'read_private_forums' ) ) { 
  8.  
  9. // What post type are we looking at? 
  10. $post_type = get_post_field( 'post_type', $args['post_id'] ); 
  11.  
  12. switch ( $post_type ) { 
  13.  
  14. // Topic 
  15. if ( bbp_is_forum_private( bbp_get_topic_forum_id( $args['post_id'] ) ) ) 
  16. $retval = ''; 
  17.  
  18. break; 
  19.  
  20. // Reply 
  21. if ( bbp_is_forum_private( bbp_get_reply_forum_id( $args['post_id'] ) ) ) 
  22. $retval = ''; 
  23.  
  24. break; 
  25.  
  26. // Post 
  27. default : 
  28. if ( bbp_is_forum_private( $args['post_id'] ) ) 
  29. $retval = ''; 
  30.  
  31. break; 
  32.  
  33. return apply_filters( 'bbp_suppress_private_author_link', $retval );