Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to make "add friend" button functions like in members directory(no reload)


  • sfikas
    Participant

    @sfikas

    Hello everyone,
    I’m writing this post because i need your help. I want to ask if is possible to make “add friend” button functions like in members directory all over the site. In a user profile if you press the add friend button, the page is reloading but in members directory this doesn’t happen. When you press the button, the request is sending and the cancel request button appears immediately without reloading the page. I want to know if i can have this functionality in “add friend” buttons that i created by calling the bp_get_add_friend_button() function.

    Thanks in advance, i’m waiting for your suggestions.

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

  • tolisvt
    Participant

    @tolisvt

    Yes i am intrested in doing this too. If anyone could help would be lifesaving.


    sfikas
    Participant

    @sfikas

    I forgot to mention the version of buddypress and wordpress in my previous post.
    Buddypress 2.0.1
    Wordpress 3.9.1


    danbp
    Participant

    @danbp

    The add friend button contains an ajaxified url, a cookie, a nonce and some other stuff. By default, this button is intended to be on members directory and on the profile header.
    Open /bp-friends/firends-widget.js to see how BP actually handle this.

    If you absolutely need to have this button elsewhere, a custom page for example, you need to extend the original class witch is in bp-xprofile-loader.php:38 (BP 2.0.1)

    Otherwise, any action on this added button will always return to the member profile page after a click and not reload like it does when in the member directory.

    I’m not a developper so i can’t help you more.
    Perhaps read here for better understanding of this button.

    File reference

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to make "add friend" button functions like in members directory(no reload)’ is closed to new replies.
Skip to toolbar