Tagged: BP Private MSG buddyboss theme
Hi
I have tried the code from Ravi for BP Nouveau, but when clicking on the Private Message Button then the browser says that the page is not available.
Could you please have a look at it?
Thank you.
Regards
DanielHere is the code I have used:
/** * Modify private message button args. * * @param array $buttons Array. * * @return array */ function buddydev_nouveau_filter_private_message_button( $buttons ) { if ( ! isset( $buttons['private_message'] ) || is_user_logged_in() ) { return $buttons; } $buttons['private_message']['must_be_logged_in'] = false; $buttons['private_message']['button_attr']['href'] = wp_login_url( site_url( '?message-redirect=' . bp_displayed_user_id() ) ); return $buttons; } add_filter( 'bp_nouveau_get_members_buttons', 'buddydev_nouveau_filter_private_message_button' ); /** * Redirect to the send message when the user logs in * */ function buddydev_redirect_to_send_message_on_login() { //make sure it is our url set in previous step if ( ! is_user_logged_in() || empty( $_GET['message-redirect'] ) ) { return; } //redirect to PM $user_id = absint( $_GET['message-redirect'] ); //let us make sure that user exists $user = get_user_by('id', $user_id ); //can not PM to invalid user //also you should not send message to yourself if ( ! $user || $user->ID == bp_loggedin_user_id() ) { return ; } $url = bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . $user->user_login ; bp_core_redirect( $url ); } add_action( 'bp_template_redirect', 'buddydev_redirect_to_send_message_on_login' );
- This topic was modified 4 years, 10 months ago by Daniel.
Hi Ravi,
It actually says this when I click on Message. It only shows a blank page with this text:
This site can’t be reached bp-messages’s server IP address could not be found.
Search Google for messages
ERR_NAME_NOT_RESOLVEDThanks for your assistance.
Regards,
DanielHello Daniel,
It seems you have a customize message url. Please replace the following code,
$url = bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . $user->user_login ;
with
$url = trailingslashit( bp_loggedin_user_domain() ) . 'bp-messages/?new-message&fast=1&to=' . $user->user_login;
Please let me know if it works or not.
Regards
RaviHi Daniel,
The problem is you are not using the core BuddyPress Messaging funcitonality. You are using the Bp Better Message plugin which does not confroms to the core API.We may not be able to help you with this as we do not use the plugin.
Regards
BrajeshThank you for the understanding Daniel. I sincerely appreciate it.
Regards
Brajesh
You must be logged in to reply to this topic.