bp_get_friend_friendship_id

Return the ID of the friendship between the logged-in user and the current user in the loop.

Description

(int) bp_get_friend_friendship_id(); 

Returns (int)

ID of the friendship.


Usage

  1. if ( !function_exists( 'bp_get_friend_friendship_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-friends/bp-friends-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_get_friend_friendship_id(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-friends/bp-friends-template.php  
  1. function bp_get_friend_friendship_id() { 
  2. global $members_template; 
  3.  
  4. if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) { 
  5. $friendship_id = friends_get_friendship_id( $members_template->member->id, bp_loggedin_user_id() ); 
  6. wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' ); 
  7.  
  8. /** 
  9. * Filters the ID of the friendship between the logged in user and the current user in the loop. 
  10. * @since 1.2.0 
  11. * @param int $friendship_id ID of the friendship. 
  12. */ 
  13. return apply_filters( 'bp_get_friend_friendship_id', $friendship_id );