Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Facebook share button in Profile

@danbp

Participant

hi @igid26,

FB’s share button on a buddyPress profile is very simple to use.
You have only to provide the profile URL, not the whole profile header.
https://developers.facebook.com/docs/plugins/share-button

The code could be something like this (not tested, not sure if you need also a API key, or some urlencoding)

<a href="https://www.facebook.com/sharer/sharer.php?u=http://example.com/members/zuzana/">Share on Facebook</a>

The picture cannot fit as you use bp_displayed_user_avatar( ‘type=full’ ) which is by default 150x150px. And FB’s code you entered is 550×550 !

To add some extra code in the header profile, you can do this with a function in a child theme functions.php instead of hardcoding the template. And another great advantage, if you use bp-custom.php, you will be totally theme independant.

function zuzanna_share_button() {
?>
	<a href="https://www.facebook.com/sharer/sharer.php?u=<?php bp_displayed_user_link(); ?>">Share on Facebook</a>
<?php
}
add_action( 'bp_before_member_header_meta', 'zuzanna_share_button' );
Skip to toolbar