Skip to:
Content
Pages
Categories
Search
Top
Bottom

Facebook share button in Profile

Viewing 3 replies - 1 through 3 (of 3 total)

  • danbp
    Participant

    @danbp

    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' );

    heilyn
    Participant

    @heilyn

    Does it means that you have to resize the default picture?


    danbp
    Participant

    @danbp

    i’m not a FB user, and never be one, so i could not answer to your question.
    But it seems to me that – if FB check the profile URL, that he would build a share interface or template with a whole profile excerpt or something.

    We both don’t know, so try the snippet as is first, and ask after.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Facebook share button in Profile’ is closed to new replies.
Skip to toolbar