Hello and don't be tired to all friends
I need to change the default Discase profile link to the template I want, but my code gets an error
I want the following template to be placed for user profiles instead of the default template of Diskaz, so that when a user clicks on the avatar and name of other users in the comments section, the link and address of the user's page will open with the following template:
mysite.
com/users/10/divar where 10 is the user id
Thank you for your help in writing this code
Some of my code that doesn't work:
function change_wpdiscuz_profile_url( $profile_url, $user_id, $url_type ) {
if ( $url_type === 'author' ) {
$new_url = home_url( '/users/' . $user_id . '/divar/' );
return $new_url;
}
return $profile_url;
}
add_filter( 'wpdiscuz_profile_url', 'change_wpdiscuz_profile_url', 10, 3 );
function change_wpdiscuz_author_link( $author_link, $comment ) {
$user_id = $comment->user_id;
$new_url = home_url( '/users/' . $user_id . '/divar/' );
$author_link = preg_replace( '/href="([^"]+)"/', 'href="' . $new_url . '"', $author_link );
return $author_link;
}
add_filter( 'wpdiscuz_author_link', 'change_wpdiscuz_author_link', 10, 2 );
function change_wpdiscuz_profile_url( $url, $user_id ) {
$new_url = home_url( '/users/' . $user_id . '/divar/' );
return $new_url;
}
add_filter( 'wpdiscuz_profile_url', 'change_wpdiscuz_profile_url', 10, 2 );
function change_wpdiscuz_avatar_link_attributes( $attributes, $comment ) {
$user_id = $comment->user_id;
$new_url = home_url( '/users/' . $user_id . '/divar/' );
$attributes['href'] = $new_url;
return $attributes;
}
add_filter( 'wpdiscuz_avatar_link_attributes', 'change_wpdiscuz_avatar_link_attributes', 10, 2 );

