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)

  • 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.


    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!


    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

    @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.

    
    
    <li><a href=&quot;/members/user_login; ?>/friends">Friends</a></li>
    
    <li><a href=&quot;/members/user_login; ?>/friends"><span style="font-weight:bold">()</span>&nbsp;&nbsp;Friends</a></li>
    
    

    and you can do the same thing with Messages

    
    
    <li><a href=&quot;/members/user_login; ?>/messages/inbox">Messages</a></li>
    
    <li><a href=&quot;/members/user_login; ?>/messages/inbox"><span style="font-weight:bold">()</span>&nbsp;&nbsp;Messages</a></li>
    
    

    hope this helps.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show pending friend requests’ is closed to new replies.
Skip to toolbar