Skip to content

Instantly share code, notes, and snippets.

@bentasm1
Last active September 22, 2016 16:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bentasm1/e81112f4e77399a0d95c to your computer and use it in GitHub Desktop.
Save bentasm1/e81112f4e77399a0d95c to your computer and use it in GitHub Desktop.
Basic integration with BuddyPress & WC Vendors Free
//THIS IS FOR WC VENDORS FREE ONLY. See KnowledgeBase @ wcvendors.com for Pro instructions.
// CHANGE /members/ to your BuddyPress Members Permalink. (/members/ is the BuddyPress Default)
// CHANGE /vendors/ to your WC Vendors Store Permalink (/vendors/ is the WC Vendors Default)
add_action('bp_member_header_actions', 'wcv_bp_member_header_actions');
function wcv_bp_member_header_actions() {
$wcv_profile_id = bp_displayed_user_id();
$wcv_profile_info = get_userdata( bp_displayed_user_id() );
$wcv_profile_role = implode( $wcv_profile_info->roles );
if ( $wcv_profile_info->roles[0] == "vendor" ) {
$vendor_name_message = get_the_author_meta( 'user_login' );
$current_user = wp_get_current_user();
echo "<br><br>";
if ( is_user_logged_in() ) {
echo "<a href=\"/members/" . $current_user->user_login . "/messages/compose/?r=" . $wcv_profile_info->user_login . "\">Send Private Message</a><br>";
} else {
echo "<a href=\"/my-account/\">Login to Send a Private Message</a><br>";
};
echo "<a href=\"/vendors/" . $wcv_profile_info->user_login . "/\">Visit Store</a>";
} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment