Add new Buddypress notification when creating an Event
-
Hi,
We’re trying to configure the Events Manager plugin to display a Buddypress notification every time a user publishes a new event. We have gone through some of the code in the plugin and found the hooks that should be used for this, but some reason our code is not working. Here’s what he have so far:/** * Catch New Event saves and add a BP notification **/ function ppt_catch_new_event_notification($result, $EM_Event) { if( $result && $EM_Event->event_status == 1 && $EM_Event->get_previous_status() != 1 ){ $user = get_userdata($EM_Event->event_owner); $member_link = bp_core_get_user_domain($user->ID); bp_notifications_add_notification( array( 'item_id' => $EM_Event->post_id, 'secondary_item_id' => $EM_Event->post_id, 'user_id' => $user->ID, 'component_name' => 'events', 'component_action' => 'ppt_new_event' )); } return $result; } add_filter('em_event_save','ppt_catch_new_event_notification', 10 , 2); /** * Add New Event notification to Buddypress **/ function ppt_add_new_event_notification($action, $item_id) { switch ($action) { case 'ppt_new_event': return '<a href="' . get_permalink($item_id) . '" title="' . __( 'New Event', 'events-manager') . '">' . __('You have added a new event','events-manager'). '</a>'; break; } } add_action("bp_em_format_notifications","ppt_add_new_event_notification", 10, 2);
The first function (ppt_catch_new_event_notification) does work, as the Notification is partially registered in Buddypress, however, it doesn’t have a title, which means that the second function is not working. Do you have any idea why this might be happening?
Any help will be greatly appreciated.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Add new Buddypress notification when creating an Event’ is closed to new replies.