BuddyPress Follow
customize follow button (7 posts)

  1. Pepperbase
    Posted 3 years ago #


    I am using your code to display the follow button:

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

    Is it possible to use the button arguments in this filter too?

    // setup the button arguments
    		$button = array(
    			'id'                => $id,
    			'component'         => 'follow',
    			'must_be_logged_in' => true,
    			'block_self'        => empty( $members_template->member ) ? true : false,
    			'wrapper_class'     => 'follow-button ' . $id,
    			'wrapper_id'        => 'follow-button-' . $leader_id,
    			'link_href'         => wp_nonce_url( $leader_domain . $bp->follow->followers->slug . '/' . $action .'/', $action . '_following' ),
    			'link_text'         => $link_text,
    			'link_title'        => $link_title,
    			'link_id'           => $class . '-' . $leader_id,
    			'link_class'        => $class

    I would like to set the link_text myself and use the Twitter Bootstrap button classes. If it is possible. Could you give an example?



  2. r-a-y
    Plugin Author

    Posted 3 years ago #

    Good catch. The button template tag needs to be more flexible so you can set those parameters when you manually add the button.

    In the meantime, you could use the existing CSS class and ID to add those styles.

  3. Pepperbase
    Posted 3 years ago #


    About the link_text in the follow button. Is there also a temporary solution to remove the name of the user? I am displaying the follow button behind a user profile link (with username as text) and it doesn't look nice to display the username twice. It also takes to much space :-)

    I could use the localization file to remove the username, but that is site wide.

    Thank you for the support.

  4. r-a-y
    Plugin Author

    Posted 3 years ago #

    You'll have to use the localizaton file until I get to this.

    Once that is done, you should be able to customize all aspects of the button.

    Keep your eye on:

  5. r-a-y
    Plugin Author

    Posted 2 years ago #

    Hi pepperbase,

    Forgot to reply back to you, but I answered a similar question awhile ago:

    You can actually set the link text by using a code snippet similar to the one I provided in that thread:

    Hope that helps.

  6. r-a-y
    Plugin Author

    Posted 2 years ago #

    Actually, after re-reading the initial post, I didn't really address the main issue of setting the other button parameters.

    But, the post above gives you a workaround until I look into this.

  7. jlooooo
    Posted 2 years ago #

    Thanks I already used the localization file to change the text, but I will change it after an update with the above solution.

    Would be nice to set the other parameters.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • BuddyPress Follow
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic