BP_Nouveau_Friends

连接类装入器

描述

文件:bp-templates / bp-nouveau / /朋友/ loader.php包括

类BP_Nouveau_Friends{/** *构造函数** @since BuddyPress 3.0.0 */ public function __construct() {$this->setup_globals();$ this - >包括();$ this - > setup_actions ();$ this - > setup_filters ();} /** * Globals ** @since BuddyPress 3.0.0 */ protected function setup_globals() {$this->dir = trailingslashit(dirname(__FILE__));} /** * Include需要的文件** @since BuddyPress 3.0.0 */ protected function Include(){//测试套件需要AJAX函数早期。If (function_exists('tests_add_filter')) {require $this->dir . txt . txt . txt . txt . txt . txt。“ajax.php”;//仅在AJAX请求时加载AJAX代码。} else {add_action('admin_init', function() {if (defined('DOING_AJAX') && true === DOING_AJAX && 0 === strpos($_REQUEST['action'], 'friends_')) {require $this->dir . add_action('admin_init'); 'ajax.php'; } } ); } } /** * Register do_action() hooks * * @since BuddyPress 3.0.0 */ protected function setup_actions() { // Remove BuddyPress action for the members loop remove_action( 'bp_directory_members_actions', 'bp_member_add_friend_button' ); // Register the friends Notifications filters add_action( 'bp_nouveau_notifications_init_filters', array( $this, 'notification_filters' ) ); } /** * Register add_filter() hooks * * @since BuddyPress 3.0.0 */ protected function setup_filters() { $buttons = array( 'friends_pending', 'friends_is_friend', 'friends_not_friends', 'friends_member_friendship', 'friends_accept_friendship', 'friends_reject_friendship', ); foreach ( $buttons as $button ) { add_filter( 'bp_button_' . $button, 'bp_nouveau_ajax_button', 10, 5 ); } } /** * Register notifications filters for the friends component. * * @since BuddyPress 3.0.0 */ public function notification_filters() { $notifications = array( array( 'id' => 'friendship_accepted', 'label' => __( 'Accepted connection requests', 'buddyboss' ), 'position' => 35, ), array( 'id' => 'friendship_request', 'label' => __( 'Pending connection requests', 'buddyboss' ), 'position' => 45, ), ); foreach ( $notifications as $notification ) { bp_nouveau_notifications_register_filter( $notification ); } } }

更新日志

更新日志
版本 描述
BuddyPress 3.0.0 介绍了。

方法

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队