Skip to main content

Custom messages location

REQUIREMENTS

To be able to implement this guide, you need to learn how to insert PHP snippets to your website.

You can find guide here: WP Beginner

By settings custom messages location its possible to integrate plugin with any other plugin or theme as messages system.

To display layout of plugin at any custom place of website you can use this function:

<?php
/**
* Displaying messages in custom place
*/
echo Better_Messages()->functions->get_page();

After that done need to point to custom place location url with next filter, so the notifications of plugin are directing to the right place:

<?php
/**
* Replacing plugin URL
*/
add_filter('bp_better_messages_page', 'overwrite_better_messages_location', 10, 2 );

function overwrite_better_messages_location( $url, $user_id ) {
return bp_core_get_user_domain( $user_id ) . 'settings/messages/';
}

Removing notice about messages location in WP Admin:

add_action( 'admin_init', 'bm_remove_admin_notices' );

function bm_remove_admin_notices(){
if( ! class_exists('Better_Messages_Hooks') ) return;

remove_action( 'admin_notices', array( Better_Messages_Hooks::instance(), 'admin_notice') );
}