BP_Activity_Component:: setup_globals (数组args美元数组()

设置组件全局变量。

描述

BP_ACTIVITY_SLUG常量已弃用,仅用于向后兼容。

另请参阅

参数

args美元

数组(可选)看到BP_Component: setup_globals ()一个描述。

默认值:数组()

文件:bp-activity /类/ class-bp-activity-component.php

公共函数setup_globals($args = array()) {$bp = buddypress();//如果需要,定义一个鼻涕虫。如果(!define('BP_ACTIVITY_SLUG') {define('BP_ACTIVITY_SLUG', $this->id);} //活动组件的全局表。$bp->table_prefix . $bp->table_prefix . $bp->table_prefix . $bp->table_prefix . $' bb_activity ', 'table_name_meta' => $bp->table_prefix . txt '' bb_activity_meta ', 'table_name_follow' => $bp->table_prefix . txt '“bp_follow”);//组组件的元数据表 $meta_tables = array( 'activity' => $bp->table_prefix . 'bp_activity_meta', ); // Fetch the default directory title. $default_directory_titles = bp_core_get_directory_page_default_titles(); $default_directory_title = $default_directory_titles[$this->id]; // All globals for activity component. // Note that global_tables is included in this array. $args = array( 'slug' => BP_ACTIVITY_SLUG, 'root_slug' => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG, 'has_directory' => true, 'directory_title' => isset( $bp->pages->activity->title ) ? $bp->pages->activity->title : $default_directory_title, 'notification_callback' => 'bp_activity_format_notifications', 'search_string' => __( 'Search Feed…', 'buddyboss' ), 'global_tables' => $global_tables, 'meta_tables' => $meta_tables, ); parent::setup_globals( $args ); // locally cache total count values for logged-in user if ( is_user_logged_in() ) { $bp->loggedin_user->total_follow_counts = bp_total_follow_counts( array( 'user_id' => bp_loggedin_user_id() ) ); } // locally cache total count values for displayed user if ( bp_is_user() && ( bp_loggedin_user_id() != bp_displayed_user_id() ) ) { $bp->displayed_user->total_follow_counts = bp_total_follow_counts( array( 'user_id' => bp_displayed_user_id() ) ); } }

更新日志

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

问题吗?

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