Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Here is the hack we are using to make our custom filter work:
<?php function likebtn_notifications_get_notifications_for_user($action, $item_id, $secondary_item_id, $total_items, $format = 'string') { global $wp_filter; $return = ''; if (count($m) == 3) { // Do something here // We modify global wp_filter to call our bbPress wrapper function if (isset($wp_filter['bp_notifications_get_notifications_for_user'][10]['bbp_format_buddypress_notifications'])) { $wp_filter['bp_notifications_get_notifications_for_user'][10]['bbp_format_buddypress_notifications']['function'] = 'likebtn_bbp_format_buddypress_notifications'; } return $return; } return $action; } // bbPres has a bug: // https://bbpress.org/forums/topic/return-value-in-bbp_format_buddypress_notifications/ // https://buddypress.trac.wordpress.org/ticket/6669 // Filter must be called before corresponding bbPress filter add_filter('bp_notifications_get_notifications_for_user', 'likebtn_notifications_get_notifications_for_user', 5, 5); // Wrapper for bbp_format_buddypress_notifications function as it is not returning $action function likebtn_bbp_format_buddypress_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string') { $result = bbp_format_buddypress_notifications($action, $item_id, $secondary_item_id, $total_items, $format); if (!$result) { $result = $action; } return $result; }
This seems to be a serious BuddyPress bug.
Check this out: https://buddypress.trac.wordpress.org/ticket/6669#comment:8
Viewing 2 replies - 1 through 2 (of 2 total)