bp_dtheme_ajax_accept_friendship

Accept a user friendship request via a POST request.

Description

bp_dtheme_ajax_accept_friendship(); 

Usage

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

Defined (1)

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

/bp-themes/bp-default/_inc/ajax.php  
  1. function bp_dtheme_ajax_accept_friendship() { 
  2. // Bail if not a POST action 
  3. if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 
  4. return; 
  5.  
  6. check_admin_referer( 'friends_accept_friendship' ); 
  7.  
  8. if ( ! friends_accept_friendship( (int) $_POST['id'] ) ) 
  9. echo "-1<div id='message' class=error><p>" . __( 'There was a problem accepting that request. Please try again.', buddypress ) . '</p></div>'; 
  10.  
  11. exit;