做了一点搜索,并不能真正找到答案。
想知道在我正在构建的插件中执行某个事件后,如何在BuddyPress中向用户发送管理栏通知吗?
BP版本-1.6.4,Wordpress版本-3.5.1
做了一点搜索,并不能真正找到答案。
想知道在我正在构建的插件中执行某个事件后,如何在BuddyPress中向用户发送管理栏通知吗?
BP版本-1.6.4,Wordpress版本-3.5.1
首先,您需要为此设置组件:
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/
每个BuddyPress组件都有一个bp-[groups|friends|...]-notifications.php
文件看看它的功能——它们正在做通知。在BuddyPress插件文件夹中搜索它们的名称,您将找到如何调用它们的位置。
如何以编程方式更新buddypress中的头像?我有一个脚本,它获取图像url,我想更新数据库中的url,以便该图像将成为用户的化身。