How to Return the number of Buddypress friend requests you have?


I want to return the number of friend requests a person has awaiting approval in buddypress. There does not seem to be an existing function.

This is my latest attempt but crashes:

if ( bp_has_members( 'include=' . bp_get_friendship_requests() . '&max=1' ) && bp_get_friendship_requests () ) :

$friendship_requests_count = 0;
while ( bp_members() ) : bp_the_member();

<p><a href="<?php echo bp_loggedin_user_domain() . BP_FRIENDS_SLUG ?>/requests"><?php echo $friendship_requests_count; ?></a></p>

<?php else : ?>

<p><?php _e( 'Zero', 'buddypress' ); ?></p>

<?php endif;?>

This is another way that may work (but returns a 0 no matter what):

$request_count = count( friends_get_friendship_request_user_ids() );
echo $request_count;

Anyone figured out something else?

Thanks guys,