Custom Notifications show up blank
-
Hiya guys.
Unfortunately, I am having serious problems with a topic seen here every once in a while. I did go through all the posts I could find and tried half a dozen approaches, but none seems to be working.
I am adding notifications to a user when someone is requesting access to a post of that user and so far, everything is fine. The notification shows up in the DB with ID, user id, item_id and secondary_id as well as component_name and component_action.
Now, whenever I receive such a notification, it shows up completely blank.
This is my code:function request_filter_notifications_get_registered_components( $component_names = array() ) { // Force $component_names to be an array if ( ! is_array( $component_names ) ) { $component_names = array(); } // Add 'custom' component to registered components array array_push( $component_names, 'project-pitches' ); // Return component's with 'custom' appended return $component_names; } add_filter( 'bp_notifications_get_registered_components', 'request_filter_notifications_get_registered_components' ); // Formatting custom with respect to action function bp_request_format_buddypress_notifications( $component_action_name, $item_id, $secondary_item_id, $item_count, $format = 'string' ) { if ($component_action_name !== 'request') { return $component_action_name ; } $link = get_site_url(); $returnlink = $link . "/my-projects/"; $request_title = "Test"; /*get_the_title($item_id);*/ $request_link = $returnlink; $request_text = "abc"; // New custom notifications if ( 'request' === $component_action_name ) { // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( 'request_filter','Your custom notification for <a href="'.$request_link.'">'.$request_title.'</a> ', $request_text, $request_link ); $return = "Test"; // Deprecated BuddyBar } else { $return = apply_filters( 'request_filter', array( 'text' => $request_text, 'link' => $request_link ), $request_link, (int) $total_items, $request_text, $request_title ); } return $return; } } add_filter( 'bp_notifications_get_notifications_for_user', 'bp_request_format_buddypress_notifications', 10, 5 );
Any idea what I might be doing wrong here? Thanks a ton, this is driving me nuts!
- You must be logged in to reply to this topic.