WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Follow
customize follow button (7 posts)

  1. Pepperbase
    Member
    Posted 1 year ago #

    Hi,

    I am using your code to display the follow button:

    <?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;
    ?>

    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?

    Thanks!

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

  2. r-a-y
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year ago #

    Great.

    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
    Member
    Plugin Author

    Posted 1 year 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:
    https://github.com/r-a-y/buddypress-followers/issues/10

  5. r-a-y
    Member
    Plugin Author

    Posted 1 year ago #

    Hi pepperbase,

    Forgot to reply back to you, but I answered a similar question awhile ago:
    https://wordpress.org/support/topic/using-an-image-instead-of-text-on-follow-buttons?replies=8#post-4349829

    You can actually set the link text by using a code snippet similar to the one I provided in that thread:
    http://pastebin.com/ST1C3NGk

    Hope that helps.

  6. r-a-y
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Posted 7 months 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

About this Topic