BP_Group_Extension: setup_display_hooks ()

挂钩这个扩展的组标签进入BuddyPress,如果必要。

描述

文件:bp-groups /类/ class-bp-group-extension.php

protected function setup_display_hooks(){//如果不是一个组,则保释。如果(!Bp_is_group ()) {return;} //只支持向后兼容性。If (('public' !== $this->visibility) && !Buddypress ()->groups->current_group->user_has_access) {return;} //如果用户可以看到导航项,我们就创建它。美元user_can_see_nav_item = $ this - > user_can_see_nav_item ();If ($user_can_see_nav_item) {$group_permalink = bp_get_group_permalink(group_get_current_group()); / /获取用户信息Bp_core_create_subnav_link (array('name' => ! $this->nav_item_name ? $this->name : $this->nav_item_name, 'slug' => $this->slug, 'parent_slug' => bp_get_current_group_slug(), 'parent_url' => $group_permalink, 'position' => $this->nav_item_position, 'item_css_id' => 'nav-' . $this->slug, 'screen_function' => array( &$this, '_display_hook' ), 'user_has_access' => $user_can_see_nav_item, 'no_access_url' => $group_permalink, ), 'groups' ); } // If the user can visit the screen, we register it. $user_can_visit = $this->user_can_visit(); if ( $user_can_visit ) { $group_permalink = bp_get_group_permalink( groups_get_current_group() ); bp_core_register_subnav_screen_function( array( 'slug' => $this->slug, 'parent_slug' => bp_get_current_group_slug(), 'screen_function' => array( &$this, '_display_hook' ), 'user_has_access' => $user_can_visit, 'no_access_url' => $group_permalink, ), 'groups' ); // When we are viewing the extension display page, set the title and options title. if ( bp_is_current_action( $this->slug ) ) { add_filter( 'bp_group_user_has_access', array( $this, 'group_access_protection' ), 10, 2 ); $extension_name = $this->name; add_action( 'bp_template_content_header', function() use ( $extension_name ) { echo esc_attr( $extension_name ); } ); add_action( 'bp_template_title', function() use ( $extension_name ) { echo esc_attr( $extension_name ); } ); } } // Hook the group home widget. if ( bp_is_group_home() ) { add_action( $this->display_hook, array( &$this, 'widget_display' ) ); } }

更新日志

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

问题吗?

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