WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Follow
[resolved] Add Follow Button on a post (8 posts)

  1. operapreneur
    Member
    Posted 1 year ago #

    Hi,

    I was wondering if anyone has integrated the followers button outside of the members profile and/or if it is possible.

    I'm trying to integrate it on posts where the member is the author.

    Thanks!

    http://wordpress.org/extend/plugins/buddypress-followers/

  2. r-a-y
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Just wrote up a tutorial on this:
    https://github.com/r-a-y/buddypress-followers/wiki/Add-a-follow-button-on-a-regular-WP-page

    See if it works for you.

  3. operapreneur
    Member
    Posted 1 year ago #

    You rock, @r-a-y!

    Works perfectly. I got it to work outside the loop as well with the following:

    $temp_post = get_post($post_id);
    	$user_id = $temp_post->post_author;
    	$author_bp = get_the_author_meta('ID' , $user_id );

    Then I replaced both get_the_author_meta( 'ID' ) in your code with $author_bp.

    Thanks a million! Great plugin!

  4. r-a-y
    Member
    Plugin Author

    Posted 1 year ago #

    Cool! Glad it worked for you.

  5. lameianx
    Member
    Posted 1 year ago #

    hello, I'm looking for this as well.

    I would like to put the 'folow' button under my 'author page'

    I tried to put the code from here
    https://github.com/r-a-y/buddypress-followers/wiki/Add-a-follow-button-on-a-regular-WP-page

    However, it doesmt work, may you please help wih this?
    Thanks so much!

  6. r-a-y
    Member
    Plugin Author

    Posted 1 year ago #

    You're probably using the code outside the loop, so follow what operapreneur posted above.

    If that doesn't work for you, you'll need to find another way to get the author user ID.

    For other alternatives to get the author user ID outside the loop, try:
    http://wordpress.stackexchange.com/a/77325

  7. lameianx
    Member
    Posted 1 year ago #

    got it thanks so much!

  8. Jmar42
    Member
    Posted 7 months ago #

    Where do you put the code? Somewhere in the editor? Sorry, I'm newbi.

    <?php
    if ( function_exists( 'bp_follow_add_follow_button' ) ) :
    if ( bp_loggedin_user_id() && bp_loggedin_user_id() != get_the_author_meta( 'ID' ) ) {
    bp_follow_add_follow_button( array(
    'leader_id' => get_the_author_meta( 'ID' ),
    'follower_id' => bp_loggedin_user_id()
    ) );
    }
    endif;
    ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic