首先,您需要为此设置组件:
function notifier_setup_globals() {
global $bp, $current_blog;
$bp->notifier = new stdClass();
$bp->notifier->id = \'notifier\';
$bp->notifier->slug = \'notifier\';
$bp->notifier->notification_callback = \'bp_notifier_format_notifications\';//this is a function which gets notifications
$bp->active_components[$bp->notifier->id] = $bp->notifier->id;
do_action( \'notifier_setup_globals\' );
}
add_action( \'bp_setup_globals\', \'notifier_setup_globals\' );
要添加通知,请在操作中调用类似以下内容:
bp_core_add_notification( $item_id, $user_id, $component_name, $component_action, $secondary_item_id = 0, $date_notified = false, $is_new = 1 ) ;
哪里
$component_name
在这种情况下是
notifier
.
进一步阅读:http://demo.myndconsulting.com/documentation/notification-functions/