/** * Fetch an array of users mutual friends. * * @param $retval * * @return mixed */ function bmf_mutual_friends_user_filter($arg) { if (defined('DOING_AJAX') && isset($_REQUEST['user_id'])) { if ('bmf_mutual_friends_dialog' === $_REQUEST['action']) { /** * Exclude all common friends */ $arg['exclude'] = bmf_uncommon_friends(intval($_REQUEST['user_id'])); $arg['user_id'] = get_current_user_id(); } else { if ('bmf_friends_dialog' === $_REQUEST['action']) { /** * Show friends if mutual friends count is 0 */ $arg['user_id'] = $_REQUEST['user_id']; } } } else { if (bp_is_mutual_friends_component()) { $arg['exclude'] = bmf_uncommon_friends(); $arg['user_id'] = get_current_user_id(); } } return $arg; }
/** * Fetch an array of users mutual friends. * * @param $retval * * @return mixed */ function bp_mutual_friends_user_filter($arg) { if (defined('DOING_AJAX') && isset($_REQUEST['user_id']) && 'mutual_friends_dialog' === $_REQUEST['action']) { $arg['exclude'] = bp_uncommon_friends(intval($_REQUEST['user_id'])); $arg['user_id'] = get_current_user_id(); } else { if (bp_is_mutual_friends_component()) { $arg['exclude'] = bp_uncommon_friends(); $arg['user_id'] = get_current_user_id(); } } return $arg; }
/** * If your component uses a top-level directory, this function will catch the requests and load * the index page. * * @package BuddyPress_Template_Pack * @since 1.0 */ function bp_mutual_friends_screen() { if (bp_is_mutual_friends_component()) { /** * Fires before the loading of template for the My Friends page. * * @since BuddyPress (1.0.0) */ do_action('mutual_friends_screen_my_friends'); /** * Filters the template used to display the My Friends page. * * @since BuddyPress (1.0.0) * * @param string $template Path to the my friends template to load. */ bp_core_load_template(apply_filters('friends_template_my_friends', 'members/single/home')); } }