Plugin Contributor
Ismail
(@elhardoum)
Hello Nik,
Thank you!
Yes that is quite possible with the filters in there:
add_filter( "bbpm_bbp_template_after_user_profile", "__return_false" );
add_filter( "bbpm_bbp_theme_after_reply_author_details", "__return_false" );
function wp_support_8799182_embed_link( $user_id ) {
// customize the output here
?>
<a href="<?php echo bbpm_get_conversation_permalink( '', $user_id ); ?>">Send <?php echo get_userdata( $user_id )->user_nicename; ?> a message</a>
<?php
}
add_action('bbp_template_after_user_profile', function() {
$user_id = bbp_get_displayed_user_id();
global $current_user;
if( empty( $current_user->ID ) || !get_userdata( $user_id ) || $user_id == $current_user->ID )
return;
wp_support_8799182_embed_link( $user_id );
});
add_action('bbp_theme_after_reply_author_details', function() {
$user_id = bbp_get_reply_author_id();
global $current_user;
if( empty( $current_user->ID ) || !get_userdata( $user_id ) || $user_id == $current_user->ID )
return;
wp_support_8799182_embed_link( $user_id );
});
Change the link output in the wp_support_8799182_embed_link callback function.
Thread Starter
lnikj
(@lnikj)
Hi Samuel
Wow! Thanks for the quick reply!
You have, however, confused me with somebody who has a clue š
Which file am I supposed to put this in?
Thanks
Nik
Plugin Contributor
Ismail
(@elhardoum)
Hey Nik,
My apologies, I should have mentioned the file.
Place that in your child theme’s functions file, or with a custom plugin. If you want to make a custom plugin and needed help then let me know.
Thanks!
Samuel
Plugin Contributor
Ismail
(@elhardoum)
I am happy to hear that!
Thanks Nick and have a good day š
Samuel.
Thread Starter
lnikj
(@lnikj)
Hi Samuel
Since you updated the plugin two days ago the bit of code your kindly wrote for me above has stopped working and I have had to disable it as it borks my functions.php.
What do I need to do to fix it?
Many thanks
Nik
Plugin Contributor
Ismail
(@elhardoum)
Hi Nik,
You should remove the code I provided you couple months ago.
So you want to filter Send a Message to PM? Use this code instead:
add_filter('bbpm_prepare_contact_button', function($args){
$args['inner_text'] = 'PM';
return $args;
});
Let me know if it helps. Thanks!
Best,
Samuel
Thread Starter
lnikj
(@lnikj)
Hi Samuel
I’m very sorry to have taken so long to get back to you on this. A domestic problem š
Thanks for sending the new code. However, something seems to be going wrong with the link generation (happens with both the old code and the new one you supplied).
The link the filter generates looks like this:
http://mysite/forums/users/nikmessages/w/1
I am guessing there should be forward slash between ‘nik’ (that’s me) and ‘messages’ in the URL?
Cheers.
Nik
Plugin Contributor
Ismail
(@elhardoum)
Hello Nik,
That’s quite alright. The link looks to me likes it is missing a trailing slash at the end of user name nik. Could you add this filter as well?
add_filter('bbpm_bbp_get_user_profile_url', 'trailingslashit');
Let me know how it goes.
Thank you!
Samuel