I found this plugin that takes all the usernames that are commented on a post and makes the link go to a different page. I’m trying to make it call the bbp_user_profile_url. This way, when the link of a user is clicked on from the comments it goes to the users bbpress profile.
My PHP is a little rusty, so I deliberately coded this wrong hoping someone can see what I’m trying to accomplish. My code modifications are at the very end.
if ( ! function_exists( 't5_comment_uri_to_author_archive' ) )
{
add_filter( 'get_comment_author_url', 't5_comment_uri_to_author_archive' );
function t5_comment_uri_to_author_archive( $uri )
{
global $comment;
// We do not get the real comment with this filter.
if ( empty ( $comment )
or ! is_object( $comment )
or empty ( $comment->comment_author_email )
or ! $user = get_user_by( 'email', $comment->comment_author_email )
)
{
return $uri;
}
return <a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>" ></a>( $user->ID );
}
}
theredheadhenry
@theredheadhenry
8 years, 3 months ago
I found this plugin that takes all the usernames that are commented on a post and makes the link go to a different page. I’m trying to make it call the bbp_user_profile_url. This way, when the link of a user is clicked on from the comments it goes to the users bbpress profile.
My PHP is a little rusty, so I deliberately coded this wrong hoping someone can see what I’m trying to accomplish. My code modifications are at the very end.