bbp_suppress_private_author_link( $author_link, $args )
Replace forum author details for users that cannot view them.
Description
Parameters
- $retval
-
(Required)
- $forum_id
-
(Required)
Return
(string)
Source
File: bp-forums/forums/template.php
function bbp_suppress_private_author_link( $author_link, $args ) {
// 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?
$post_type = get_post_field( 'post_type', $args['post_id'] );
switch ( $post_type ) {
// Topic
case bbp_get_topic_post_type() :
if ( bbp_is_forum_private( bbp_get_topic_forum_id( $args['post_id'] ) ) )
$retval = '';
break;
// Reply
case bbp_get_reply_post_type() :
if ( bbp_is_forum_private( bbp_get_reply_forum_id( $args['post_id'] ) ) )
$retval = '';
break;
// Post
default :
if ( bbp_is_forum_private( $args['post_id'] ) )
$retval = '';
break;
}
}
return apply_filters( 'bbp_suppress_private_author_link', $retval );
}
Changelog
| Version | Description |
|---|---|
| bbPress (r3162) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.