bbp_suppress_private_author_link( string $author_link = '', array $args = array() )
Replace forum author details for users that cannot view them.
Description Description
Parameters Parameters
- $author_link
-
(Optional)
Default value: ''
- $args
-
(Optional)
Default value: array()
Return Return
(string)
Source Source
File: includes/forums/template.php
function bbp_suppress_private_author_link( $author_link = '', $args = array() ) {
// Assume the author link is the return value
$retval = $author_link;
// Show the normal author link
if ( ! empty( $args['post_id'] ) && ! current_user_can( 'read_private_forums' ) ) {
// What post type are we looking at?
switch ( get_post_type( $args['post_id'] ) ) {
// Topic
case bbp_get_topic_post_type() :
$forum_id = bbp_get_topic_forum_id( $args['post_id'] );
break;
// Reply
case bbp_get_reply_post_type() :
$forum_id = bbp_get_reply_forum_id( $args['post_id'] );
break;
// Post
default :
$forum_id = bbp_get_forum_id( $args['post_id'] );
break;
}
// Hide if forum is private
if ( bbp_is_forum_private( $forum_id ) ) {
$retval = '';
}
}
// Filter & return
return apply_filters( 'bbp_suppress_private_author_link', $retval, $author_link, $args );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |