[buddypress-trac] [BuddyPress Trac] #6669: Blank notifications when using the bp_notifications_get_notifications_for_user filter hook
buddypress-trac
noreply at wordpress.org
Thu Nov 12 07:35:04 UTC 2015
#6669: Blank notifications when using the
bp_notifications_get_notifications_for_user filter hook
---------------------------------------+----------------------
Reporter: henry.wright | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Component - Notifications | Version:
Severity: normal | Resolution: invalid
Keywords: |
---------------------------------------+----------------------
Comment (by likebtn):
OK. Here is the hack we are using to make our custom filter work:
{{{#!php
<?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;
}
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6669#comment:10>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list