Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using BuddyPress Message system in other parts of your WC Vendors Site
/* Buddypress Private Messaging Mod */
Usage :
Put this in your templates to create a message link you can then style
templates this could go in :
* description.php (put the message link in the end of the description)
* content-singple-product.php (place this message above the item details, if you combine this with a small vendor header)
* order-details.php (allows them to message about an order)
* archive-product.php (Put a vendor header in the per vendor product pages)
if ( function_exists('bp_is_active') ) { ?>
<a href="<?php echo bp_custom_get_send_private_message_link($product->post->post_author,'Subject here','Predefined message Information');?>">> MESSAGE SELLER</a>
<?php } ?>
// Change the Buddypress Search Slug to stop search collision.
define( 'BP_SEARCH_SLUG', 'searching' );
function bp_custom_get_send_private_message_link($to_id, $subject=false, $message=false) {
//if user is not logged, do not prepare the link
if ( !is_user_logged_in() ) return false;
$compose_url=bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?';
$compose_url.=('r=' . bp_core_get_username( $to_id ));
return wp_nonce_url( $compose_url ) ;
Auto populate the message content
function bp_custom_message_content_value($content){
if(!empty ($content)) return $content;
return $content;
Auto Populate subject
function bp_custom_get_messages_subject_value($subject){
return $subject;
return $subject;
Copy link

digitalchild commented Oct 16, 2014

This should go in a file called bp-custom.php in your wp-content/plugins/ directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment