• I noticed when you helped me display the comma separated list of user ID’s that I did not need to use global $bp; in order for this to work.

    Is it also possible to also display the Follow/Unfollow button anywhere within a theme?

    For example, when viewing a post from someone, have a sidebar option to Follow this user.

    I’m having trouble locating which function displays the Follow/Unfollow button. Is it in bp-follow-hooks.php where I see bp_follow_add_follow_button(); ? I have tried <?php bp_follow_add_follow_button(); ?> and <?php echo bp_follow_add_follow_button(); ?> but they come up blank. I’m probably doing it wrong again.

    https://wordpress.org/plugins/buddypress-followers/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter scodal

    (@scodal)

    I apologize, I see the solution here:
    https://wordpress.org/support/topic/add-follow-button-on-regular-page-singlephp-not-showing?replies=3

    However, I see this is a plain text page refreshing method. How would one make it function slick like the button found on the members loop?

    Also, what is a leader_id? I see that a lot in the source, but am unsure what a leader is considered

    Plugin Author r-a-y

    (@r-a-y)

    How would one make it function slick like the button found on the members loop?

    You are referring to AJAX. For custom buttons, you need to add in the AJAX JS function call manually.

    Something like the advice in this support thread:
    https://wordpress.org/support/topic/ajax-doesnt-respect-link-class-param?replies=3#post-6018349

    Also, what is a leader_id?

    A leader is the person you want to follow.
    A follower is the person that wants to follow the leader.

    Thread Starter scodal

    (@scodal)

    Nice, thanks for explaining leader/follower. That makes sense now.

    Also, I read that and played with it for some time and realized it’s above my head at this point in time.

    In the example you gave,

    jq('#WHATEVER_YOUR_SELECTOR_IS').on("click", ".follow-button a", function() {
    	bp_follow_button_action( jq(this) );
    	return false;
    });

    How do I determine what to change WHATEVER_YOUR_SELECTOR_IS? Can you give an example of how to use this?

    Plugin Author r-a-y

    (@r-a-y)

    How do I determine what to change WHATEVER_YOUR_SELECTOR_IS?

    The selector should be the parent container that has the follow button.

    So let’s say my HTML markup looks like this:

    <div id="my-container">
        <div id="follow-button" class="generic-button follow-button"><a class="follow" href="XXX">Follow</a></div>
    </div>

    The selector would be #my-container.

    If you need more help on selectors, I would suggest reading jQuery’s documentation on selectors.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display Follow/Unfollow button anywhere?’ is closed to new replies.