本文整理汇总了PHP中bp_get_current_group_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_current_group_slug函数的具体用法?PHP bp_get_current_group_slug怎么用?PHP bp_get_current_group_slug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_current_group_slug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: custom_media_nav_tab
/**
* Load Custom tabs on BuddyPress
*
* @global object $bp global BuddyPress object
*/
function custom_media_nav_tab()
{
global $bp;
if (!function_exists("bp_core_new_nav_item")) {
return;
}
if (bp_is_blog_page() || !bp_is_group() && !(isset($bp->displayed_user) && isset($bp->displayed_user->id)) || apply_filters('rtmedia_render_bp_nav', false)) {
return;
}
global $rtmedia;
if (function_exists("bp_is_group") && !bp_is_group()) {
if (isset($bp->displayed_user) && isset($bp->displayed_user->id)) {
$profile_counts = $this->actual_counts($bp->displayed_user->id);
}
$tab_position = apply_filters('rtmedia_media_tab_position', 99);
if ($rtmedia->options["buddypress_enableOnProfile"] != 0) {
bp_core_new_nav_item(array('name' => RTMEDIA_MEDIA_LABEL . '<span>' . $profile_counts['total']['all'] . '</span>', 'slug' => apply_filters('rtmedia_media_tab_slug', RTMEDIA_MEDIA_SLUG), 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all', 'position' => $tab_position));
}
}
if (bp_is_group() && $rtmedia->options["buddypress_enableOnGroup"] != 0) {
global $bp;
$media_enabled = true;
//filter for rtMedia PRO for PER GROUP MEDIA enable/disable functionality
$media_enabled = apply_filters('rtmedia_media_enabled_for_current_group', $media_enabled);
// check if current user can view this group
$current_group = groups_get_current_group();
$is_visible_to_current_user = $current_group->is_visible;
if ($media_enabled && $is_visible_to_current_user) {
$group_counts = $this->actual_counts($bp->groups->current_group->id, "group");
$bp->bp_options_nav[bp_get_current_group_slug()]['media'] = array('name' => RTMEDIA_MEDIA_LABEL . '<span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . RTMEDIA_MEDIA_SLUG, 'slug' => RTMEDIA_MEDIA_SLUG, 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all');
}
}
}
开发者ID:saisai,项目名称:rtMedia,代码行数:38,代码来源:RTMediaNav.php
示例2: custom_media_nav_tab
/**
* Load Custom tabs on BuddyPress
*
* @global object $bp global BuddyPress object
*/
function custom_media_nav_tab()
{
$bp = buddypress();
if (!function_exists('bp_core_new_nav_item')) {
return;
}
if (bp_is_blog_page() || !bp_is_group() && !(isset($bp->displayed_user) && isset($bp->displayed_user->id)) || apply_filters('rtmedia_render_bp_nav', false)) {
return;
}
global $rtmedia;
if (function_exists('bp_is_group') && !bp_is_group()) {
if (isset($bp->displayed_user) && isset($bp->displayed_user->id)) {
$profile_counts = $this->actual_counts($bp->displayed_user->id);
}
$tab_position = apply_filters('rtmedia_media_tab_position', 99);
if (0 !== intval($rtmedia->options['buddypress_enableOnProfile'])) {
bp_core_new_nav_item(array('name' => RTMEDIA_MEDIA_LABEL . ' <span>' . $profile_counts['total']['all'] . '</span>', 'slug' => apply_filters('rtmedia_media_tab_slug', RTMEDIA_MEDIA_SLUG), 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all', 'position' => $tab_position));
}
}
if (bp_is_group() && 0 !== intval($rtmedia->options['buddypress_enableOnGroup'])) {
$media_enabled = true;
//filter for rtMedia PRO for PER GROUP MEDIA enable/disable functionality
$media_enabled = apply_filters('rtmedia_media_enabled_for_current_group', $media_enabled);
// check if current user can view this group
$current_group = groups_get_current_group();
/**
* remove `$current_group->is_visible` and add `bp_group_is_visible( $current_group )`
* reason : In Buddypress 2.7 `is_visible` return false so we can't display `media` tab on group
* issue id : http://git.rtcamp.com/rtmedia/rtMedia/issues/119
*/
// $is_visible_to_current_user = $current_group->is_visible;
$is_visible_to_current_user = bp_group_is_visible($current_group);
if ($media_enabled && $is_visible_to_current_user) {
$group_counts = $this->actual_counts($bp->groups->current_group->id, 'group');
$slug = apply_filters('rtmedia_group_media_tab_slug', RTMEDIA_MEDIA_SLUG);
if (isset($bp->version) && $bp->version > '2.5.3') {
/*
* As from BuddyPress 2.6, you can't access $bp->bp_options_nav directly.
* Use `bp_core_new_subnav_item` to add subnav item.
*
* Check https://buddypress.trac.wordpress.org/ticket/6534 and https://buddypress.trac.wordpress.org/changeset/10745
* for more details
*/
bp_core_new_subnav_item(array('name' => RTMEDIA_MEDIA_LABEL . ' <span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . $slug, 'slug' => $slug, 'parent_slug' => bp_get_current_group_slug(), 'parent_url' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/'), 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all'));
} else {
$bp->bp_options_nav[bp_get_current_group_slug()]['media'] = array('name' => RTMEDIA_MEDIA_LABEL . ' <span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . $slug, 'slug' => $slug, 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all');
}
}
}
}
开发者ID:rtCamp,项目名称:rtMedia,代码行数:55,代码来源:RTMediaNav.php
示例3: test_backcompat_remove_group_nav_items
public function test_backcompat_remove_group_nav_items()
{
$g1 = $this->factory->group->create();
// In group context
$g_obj = groups_get_group($g1);
$this->go_to(bp_get_group_permalink($g_obj));
bp_core_new_subnav_item(array('name' => 'Clam', 'slug' => 'clam', 'parent_slug' => bp_get_current_group_slug(), 'parent_url' => bp_get_group_permalink($g_obj), 'screen_function' => 'clam_subnav'));
bp_core_remove_subnav_item($g_obj->slug, 'clam');
$nav = bp_get_nav_menu_items('groups');
$found = false;
foreach ($nav as $_nav) {
if ('clam' === $_nav->css_id) {
$found = true;
break;
}
}
$this->assertFalse($found);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:18,代码来源:bpCoreRemoveSubnavItem.php
示例4: setup_display_hooks
/**
* Hook this extension's group tab into BuddyPress, if necessary
*
* @since BuddyPress (1.8)
*/
protected function setup_display_hooks()
{
// Bail if not a group
if (!bp_is_group()) {
return;
}
// Bail if the current user doesn't have access
if ('public' !== $this->visibility && !buddypress()->groups->current_group->user_has_access) {
return;
}
if (true === $this->enable_nav_item) {
bp_core_new_subnav_item(array('name' => !$this->nav_item_name ? $this->name : $this->nav_item_name, 'slug' => $this->slug, 'parent_slug' => bp_get_current_group_slug(), 'parent_url' => bp_get_group_permalink(groups_get_current_group()), 'position' => $this->nav_item_position, 'item_css_id' => 'nav-' . $this->slug, 'screen_function' => array(&$this, '_display_hook'), 'user_has_access' => $this->enable_nav_item));
// When we are viewing the extension display page, set the title and options title
if (bp_is_current_action($this->slug)) {
add_action('bp_template_content_header', create_function('', 'echo "' . esc_attr($this->name) . '";'));
add_action('bp_template_title', create_function('', 'echo "' . esc_attr($this->name) . '";'));
}
}
// Hook the group home widget
if (!bp_current_action() && bp_is_current_action('home')) {
add_action($this->display_hook, array(&$this, 'widget_display'));
}
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:28,代码来源:bp-groups-classes.php
示例5: printPostsByBuddypressGroupTax
/**
* Prints a linked list of all posts assigned to the buddypress $groupslug or if not set the current Buddypress group.
*
* @param string $groupslug slug of the buddypress_group taxonomy to get the post of (the slug should be sthe same as the real Buddypress group slug)
*/
function printPostsByBuddypressGroupTax($groupslug = NULL)
{
if (function_exists('bp_get_current_group_slug')) {
if (is_null($groupslug)) {
$currentgroup = bp_get_current_group_slug();
$posts = get_posts(array('numberposts' => -1, 'post_type' => 'post', 'tax_query' => array(array('taxonomy' => 'buddypress_groups', 'field' => 'slug', 'terms' => $currentgroup))));
if ($posts) {
?>
<ul class="posts_by_buddypressgroup">
<?php
foreach ($posts as $post) {
?>
<li><a href="<?php
echo esc_url(get_permalink($post->ID));
?>
" title="<?php
echo esc_attr($post->post_title);
?>
"><?php
echo esc_html($post->post_title);
?>
</a></li>
<?php
}
?>
</ul>
<?php
}
}
}
}
开发者ID:acrylian,项目名称:buddypress_group_taxonomy,代码行数:36,代码来源:buddypress-group-taxonomy.php
示例6: setup_display_hooks
/**
* Hook this extension's group tab into BuddyPress, if necessary.
*
* @since BuddyPress (1.8.0)
*/
protected function setup_display_hooks()
{
// Bail if not a group
if (!bp_is_group()) {
return;
}
// Backward compatibility only
if ('public' !== $this->visibility && !buddypress()->groups->current_group->user_has_access) {
return;
}
// If the user can see the nav item, we create it.
$user_can_see_nav_item = $this->user_can_see_nav_item();
if ($user_can_see_nav_item) {
$group_permalink = bp_get_group_permalink(groups_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));
}
// 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));
// 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);
add_action('bp_template_content_header', create_function('', 'echo "' . esc_attr($this->name) . '";'));
add_action('bp_template_title', create_function('', 'echo "' . esc_attr($this->name) . '";'));
}
}
// Hook the group home widget
if (!bp_current_action() && bp_is_current_action('home')) {
add_action($this->display_hook, array(&$this, 'widget_display'));
}
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:38,代码来源:class-bp-group-extension.php
示例7: test_bp_core_new_subnav_item_should_work_in_group_context
/**
* @group groups
*/
public function test_bp_core_new_subnav_item_should_work_in_group_context()
{
$this->set_up_group();
bp_core_new_subnav_item(array('name' => 'Foo Subnav', 'slug' => 'foo-subnav', 'parent_slug' => bp_get_current_group_slug(), 'parent_url' => bp_get_group_permalink(groups_get_current_group()), 'screen_function' => 'foo_subnav'));
$bp = buddypress();
// Touch bp_nav since we told PHPUnit it was expectedDeprecated.
$f = $bp->bp_options_nav[bp_get_current_group_slug()];
$nav = bp_get_nav_menu_items('groups');
foreach ($nav as $_nav) {
if ('foo-subnav' === $_nav->css_id) {
$found = $_nav;
break;
}
}
$this->assertSame('Foo Subnav', $found->name);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:19,代码来源:backCompat.php
示例8: rtmedia_pagination_page_link
function rtmedia_pagination_page_link($page_no)
{
global $rtmedia_media, $rtmedia_interaction, $rtmedia_query;
$page_url = 'pg/' . $page_no;
$site_url = is_multisite() ? trailingslashit(get_site_url(get_current_blog_id())) : trailingslashit(get_site_url());
$author_name = get_query_var('author_name');
$link = '';
if ($rtmedia_interaction && isset($rtmedia_interaction->context) && $rtmedia_interaction->context->type == "profile") {
if (function_exists("bp_core_get_user_domain")) {
$link .= trailingslashit(bp_core_get_user_domain($rtmedia_query->media_query['media_author']));
} else {
$link .= $site_url . 'author/' . $author_name . '/';
}
} else {
if ($rtmedia_interaction && isset($rtmedia_interaction->context) && $rtmedia_interaction->context->type == 'group') {
if (function_exists("bp_get_current_group_slug")) {
$link .= $site_url . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/';
}
} else {
//$post = get_post ( $rtmedia_media->post_parent );
$post = get_post(get_post_field("post_parent", $rtmedia_query->media->media_id));
$link .= $site_url . $post->post_name . '/';
}
}
$link .= RTMEDIA_MEDIA_SLUG . '/';
if (isset($rtmedia_query->media_query["album_id"]) && intval($rtmedia_query->media_query["album_id"]) > 0) {
$link .= $rtmedia_query->media_query["album_id"] . "/";
}
if (isset($rtmedia_query->action_query->media_type)) {
if (in_array($rtmedia_query->action_query->media_type, array("photo", "music", "video", "album", "playlist"))) {
$link .= $rtmedia_query->action_query->media_type . '/';
}
}
return apply_filters('rtmedia_pagination_page_link', $link . $page_url, $link, $page_url);
}
开发者ID:EfncoPlugins,项目名称:rtMedia,代码行数:35,代码来源:rt-template-functions.php
示例9: get_create_link
function get_create_link($link)
{
$slug = bp_get_current_group_slug();
if ($slug && current_user_can('bp_docs_associate_with_group', bp_get_current_group_id())) {
$link = add_query_arg('group', $slug, $link);
}
return $link;
}
开发者ID:projectestac,项目名称:wordpress-buddypress-docs,代码行数:8,代码来源:integration-groups.php
示例10: single_template_hierarchy
/**
* Add custom template hierarchy to theme compat for group pages.
*
* This is to mirror how WordPress has
* {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
*
* @since BuddyPress (1.8.0)
*
* @param string $templates The templates from bp_get_theme_compat_templates().
* @return array $templates Array of custom templates to look for.
*/
public function single_template_hierarchy($templates)
{
// Setup some variables we're going to reference in our custom templates
$group = groups_get_current_group();
// Setup our templates based on priority
$new_templates = apply_filters('bp_template_hierarchy_groups_single_item', array('groups/single/index-id-' . sanitize_file_name(bp_get_current_group_id()) . '.php', 'groups/single/index-slug-' . sanitize_file_name(bp_get_current_group_slug()) . '.php', 'groups/single/index-action-' . sanitize_file_name(bp_current_action()) . '.php', 'groups/single/index-status-' . sanitize_file_name($group->status) . '.php', 'groups/single/index.php'));
// Merge new templates with existing stack
// @see bp_get_theme_compat_templates()
$templates = array_merge((array) $new_templates, $templates);
return $templates;
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:22,代码来源:bp-groups-screens.php
示例11: get_component
/**
* Get the component to which the a nav item belongs.
*
* We use the following heuristic to guess, based on an offset, which component the item belongs to:
* - If this is a group, and the offset is the same as the current group's slug, it's a group nav item.
* - Otherwise, it's a member nav item.
*
* @since 2.6.0
*
* @param mixed $offset Array offset.
* @return string
*/
public function get_component($offset = '')
{
if (!isset($this->component)) {
if (bp_is_active('groups') && $offset === bp_get_current_group_slug()) {
$this->component = 'groups';
} else {
$this->component = 'members';
}
}
return $this->component;
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:23,代码来源:class-bp-core-bp-nav-backcompat.php
示例12: get_create_link
function get_create_link($link)
{
if (bp_is_group()) {
$link = add_query_arg('group', bp_get_current_group_slug(), $link);
}
return $link;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:7,代码来源:integration-groups.php
示例13: display
function display($group_id = null)
{
$this->appliquerCaracterePrive();
// paramètres automatiques :
// - domaine racine
$this->config['domainRoot'] = $this->getServerRoot();
// - URI de base
$this->config['baseUri'] = $this->getBaseUri();
// - URI de base pour les données (/wp-content/*)
$this->config['dataBaseUri'] = $this->getDataBaseUri();
// - nom de la liste
if (empty($this->config['ezmlm-php']['list'])) {
$this->config['ezmlm-php']['list'] = bp_get_current_group_slug();
}
//var_dump($this->config);
// portée des styles
echo '<div class="wp-bootstrap">';
echo '<div id="ezmlm-forum-main">';
// amorcer l'outil
chdir(dirname(__FILE__) . "/forum/");
require "ezmlm-forum.php";
$fc = new EzmlmForum($this->config);
// front controller
// - définir le titre
// - inclure le corps de page
$fc->renderPage();
echo "</div>";
echo "</div>";
}
开发者ID:telabotanica,项目名称:ep-plugin,代码行数:29,代码来源:forum.php
示例14: buatp_prepare_url
function buatp_prepare_url($url = '')
{
global $bp;
if (!$url) {
return;
}
if ($url == 'current') {
$url = str_replace(site_url(), '', buatp_get_full_url());
}
$current_user = get_userdata($bp->displayed_user->id);
if (function_exists('bp_get_current_group_slug')) {
$current_group_slug = bp_get_current_group_slug();
}
$bp_components = array('[user_name]' => $current_user->user_login, '[group_name]' => $current_group_slug);
foreach ($bp_components as $code => $val) {
if (strpos($url, $code) && $val) {
$url = str_replace($code, $val, $url);
}
}
return $url;
}
开发者ID:jfeliweb,项目名称:BuddyPress-User-Account-Type,代码行数:21,代码来源:bp-user-type-functions.php
示例15: bp_has_groups_hierarchy
/**
* Hierarchy-aware replacement for bp_has_groups
*/
function bp_has_groups_hierarchy($args = '')
{
global $groups_template, $bp;
/***
* Set the defaults based on the current page. Any of these will be overridden
* if arguments are directly passed into the loop. Custom plugins should always
* pass their parameters directly to the loop.
*/
$type = 'active';
$user_id = false;
$search_terms = false;
$slug = false;
/* User filtering */
if (bp_displayed_user_id()) {
$user_id = bp_displayed_user_id();
}
/* Type */
if ('my-groups' == bp_current_action()) {
if ('most-popular' == $order) {
$type = 'popular';
} else {
if ('alphabetically' == $order) {
$type = 'alphabetical';
}
}
} else {
if ('invites' == bp_current_action()) {
$type = 'invites';
} else {
if (bp_get_current_group_slug()) {
$type = 'single-group';
$slug = bp_get_current_group_slug();
}
}
}
if (isset($_REQUEST['group-filter-box']) || isset($_REQUEST['s'])) {
$search_terms = isset($_REQUEST['group-filter-box']) ? $_REQUEST['group-filter-box'] : $_REQUEST['s'];
}
$defaults = array('type' => $type, 'page' => 1, 'per_page' => 20, 'max' => false, 'user_id' => $user_id, 'slug' => $slug, 'search_terms' => $search_terms, 'populate_extras' => true);
$r = wp_parse_args($args, $defaults);
extract($r);
$groups_template = new BP_Groups_Hierarchy_Template((int) $user_id, $type, (int) $page, (int) $per_page, (int) $max, $slug, $search_terms, (bool) $populate_extras, (int) $parent_id);
return apply_filters('bp_has_groups', $groups_template->has_groups(), $groups_template);
}
开发者ID:elderfd,项目名称:cfsf,代码行数:47,代码来源:bp-group-hierarchy-template.php
示例16: rtmedia_pagination_page_link
/**
* get media page link
*
* @global object $rtmedia_interaction
* @global RTMediaQuery $rtmedia_query
*
* @param string $page_no
*
* @return string
*/
function rtmedia_pagination_page_link($page_no = '')
{
global $rtmedia_interaction, $rtmedia_query;
$page_url = 'pg/' . $page_no;
$site_url = is_multisite() ? trailingslashit(get_site_url(get_current_blog_id())) : trailingslashit(get_site_url());
$author_name = get_query_var('author_name');
$link = '';
if ($rtmedia_interaction && isset($rtmedia_interaction->context) && 'profile' === $rtmedia_interaction->context->type) {
if (function_exists('bp_core_get_user_domain') && !empty($rtmedia_query->media_query['media_author'])) {
$link .= trailingslashit(bp_core_get_user_domain($rtmedia_query->media_query['media_author']));
} else {
$link .= $site_url . 'author/' . $author_name . '/';
}
} else {
if ($rtmedia_interaction && isset($rtmedia_interaction->context) && 'group' === $rtmedia_interaction->context->type) {
if (function_exists('bp_get_current_group_slug')) {
$link .= $site_url . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/';
}
} elseif (isset($rtmedia_query->media->media_id)) {
$post = get_post(get_post_field('post_parent', $rtmedia_query->media->media_id));
$link .= $site_url . $post->post_name . '/';
}
}
$link .= RTMEDIA_MEDIA_SLUG . '/';
if (isset($rtmedia_query->media_query['album_id']) && intval($rtmedia_query->media_query['album_id']) > 0) {
$link .= $rtmedia_query->media_query['album_id'] . '/';
}
if (isset($rtmedia_query->action_query->media_type)) {
$media_type_array = array('photo', 'music', 'video', 'album', 'playlist');
if (in_array($rtmedia_query->action_query->media_type, $media_type_array, true)) {
$link .= $rtmedia_query->action_query->media_type . '/';
}
}
return apply_filters('rtmedia_pagination_page_link', $link . $page_url, $link, $page_url);
}
开发者ID:rtCamp,项目名称:rtMedia,代码行数:45,代码来源:rtmedia-functions.php
示例17: bp_group_documents_setup_nav
/**
* bp_group_documents_setup_nav()
*
* Sets up the navigation items for the component.
* Adds documents item under the group navigation
*/
function bp_group_documents_setup_nav()
{
global $bp, $current_blog, $group_object;
if (!class_exists('BP_Groups_Group')) {
return false;
}
if (!isset($bp->groups->current_group->id)) {
return false;
}
//if documents have been explicitly deactivated for this group, do not show menu
if (!get_option('bp_group_documents_enable_all_groups') && groups_get_groupmeta($bp->groups->current_group->id, 'group_documents_documents_disabled')) {
return false;
}
$groups_link = $bp->root_domain . '/' . $bp->groups->slug . '/';
if (isset($bp->groups->current_group->slug)) {
$groups_link .= $bp->groups->current_group->slug . '/';
}
/* Add the subnav item only to the single group nav item*/
if ($bp->is_single_item) {
bp_core_new_subnav_item(array('name' => __('Documents', 'bp-group-documents'), 'slug' => $bp->group_documents->slug, 'parent_url' => $groups_link, 'parent_slug' => bp_get_current_group_slug(), 'screen_function' => 'bp_group_documents_display', 'position' => 35, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'group-documents'));
}
do_action('bp_group_documents_nav_setup');
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:29,代码来源:index.php
示例18: calendar_nav_setup
/**
* Sets up the Calendar tab
*
* @package CollabPress
* @subpackage CP BP
* @since 1.2
*/
function calendar_nav_setup()
{
bp_core_new_subnav_item(array('name' => __('Calendar', 'collabpress'), 'slug' => 'calendar', 'parent_slug' => bp_get_current_group_slug(), 'parent_url' => bp_get_group_permalink(groups_get_current_group()), 'screen_function' => array($this, '_calendar_display_hook'), 'position' => 34));
}
开发者ID:clarkewd,项目名称:CollabPress,代码行数:11,代码来源:cp-bp-groups.php
示例19: while
<?php
/**
* Apocrypha Theme Group Profile Template
* Andrew Clayton
* Version 2.0
* 10-18-2014
*/
// Load the requested group
if (bp_has_groups()) {
while (bp_groups()) {
bp_the_group();
// Specific group overrides
$header = 'entropy-rising' == bp_get_current_group_slug() ? 'er' : '';
?>
<?php
get_header($header);
?>
<div id="content" role="main">
<?php
apoc_breadcrumbs();
?>
<?php
locate_template(array('groups/single/group-header.php'), true);
?>
<div id="profile-body">
<?php
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:31,代码来源:home.php
示例20: bp_core_new_subnav_item
/**
* Add an item to secondary navigation of the specified component.
*
* @since 1.1.0
* @since 2.6.0 Introduced the `$component` parameter.
*
* @param array|string $args {
* Array describing the new subnav item.
* @type string $name Display name for the subnav item.
* @type string $slug Unique URL slug for the subnav item.
* @type string $parent_slug Slug of the top-level nav item under which the new subnav item should
* be added.
* @type string $parent_url URL of the parent nav item.
* @type bool|string $item_css_id Optional. 'id' attribute for the nav item. Default: the value of `$slug`.
* @type bool $user_has_access Optional. True if the logged-in user has access to the subnav item,
* otherwise false. Can be set dynamically when registering the subnav;
* eg, use `bp_is_my_profile()` to restrict access to profile owners only.
* Default: true.
* @type bool $site_admin_only Optional. Whether the nav item should be visible only to site admins
* (those with the 'bp_moderate' cap). Default: false.
* @type int $position Optional. Numerical index specifying where the item should appear in the
* subnav array. Default: 90.
* @type callable $screen_function The callback function that will run when the nav item is clicked.
* @type string $link Optional. The URL that the subnav item should point to. Defaults to a value
* generated from the `$parent_url` + `$slug`.
* @type bool $show_in_admin_bar Optional. Whether the nav item should be added into the group's "Edit"
* Admin Bar menu for group admins. Default: false.
* }
* @param string $component The component the navigation is attached to. Defaults to 'members'.
* @return bool|null Returns false on failure.
*/
function bp_core_new_subnav_item($args, $component = null)
{
// Backward compatibility for plugins using `bp_core_new_subnav_item()` without `$component`
// to add group subnav items.
if (null === $component && bp_is_active('groups') && bp_is_group() && isset($args['parent_slug'])) {
/*
* Assume that this item is intended to belong to the current group if:
* a) the 'parent_slug' is the same as the slug of the current group, or
* b) the 'parent_slug' starts with the slug of the current group, and the members nav doesn't have
* a primary item with that slug.
*/
$group_slug = bp_get_current_group_slug();
if ($group_slug === $args['parent_slug'] || 0 === strpos($args['parent_slug'], $group_slug) && !buddypress()->members->nav->get_primary(array('slug' => $args['parent_slug']), false)) {
$component = 'groups';
}
}
if (!$component) {
$component = 'members';
}
if (!bp_is_active($component)) {
return;
}
// First, register the subnav item in the nav.
$subnav_item = bp_core_create_subnav_link($args, $component);
/*
* To mimic legacy behavior, if bp_core_create_subnav_link() returns false, we make an
* early exit and don't attempt to register the screen function.
*/
if (false === $subnav_item) {
return false;
}
// Then, hook the screen function for the added subnav item.
$hooked = bp_core_register_subnav_screen_function($subnav_item, $component);
if (false === $hooked) {
return false;
}
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:68,代码来源:bp-core-buddybar.php
注:本文中的bp_get_current_group_slug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论