Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show pending friend requests

  • Do you know if it’s possible to show the number of pending friend requests, just the way it shows up on the Friends nav-bar? I just want to print this number somewhere else, beside the Friends nav-bar. [e.g. Requests(x)]

    I tried to replicate what the “friends_setup_nav” function does (http://bp-dev.org/phpxref/bp-friends.php.source.html#l65) but I couldn’t make it work.

    Any help would be much appreciated!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    Use the function: bp_friend_total_requests_count()

    It’s in the file bp-friends-templatetags.php

    Thanks a lot Roger! It worked like a charm :) I knew it was simple, but I couldn’t find the right function.

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @jimhellas – yes, I find myself using “find in files” a lot in my editor :-)

    Finding time to write sections on the API in the documentation is step 2!

    Avatar of murasaki
    murasaki
    Participant

    @iamsincere

    ok , i have a similar question, how can i use an if statement to show if a request is pending? like, this:

    `if (bp_is_friends() )
    //then this
    else if ( -this is the pending part )
    // pending
    else
    // this `

    how would i do that? i bet tis waaaay more simple than im guessing lol

    Avatar of msullens88
    msullens88
    Member

    @msullens88

    @murasaki – this is the code I used to show either “(3) Friends” or just “Friends” based on how many requests that users has on there profile page.

    `

  • <a href="/members/user_login; ?>/friends”>Friends
  • <a href="/members/user_login; ?>/friends”>()  Friends
  • `

    and you can do the same thing with Messages

    `

  • <a href="/members/user_login; ?>/messages/inbox”>Messages
  • <a href="/members/user_login; ?>/messages/inbox”>()  Messages
  • `

    hope this helps.

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

You must be logged in to reply to this topic.