当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_forums_has_directory函数代码示例

本文整理汇总了PHP中bp_forums_has_directory函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_forums_has_directory函数的具体用法?PHP bp_forums_has_directory怎么用?PHP bp_forums_has_directory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_forums_has_directory函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bp_core_exclude_pages

/**
 * Prevent specific pages (eg 'Activate') from showing on page listings.
 *
 * @uses bp_is_active() checks if a BuddyPress component is active.
 *
 * @param array $pages List of excluded page IDs, as passed to the
 *                     'wp_list_pages_excludes' filter.
 * @return array The exclude list, with BP's pages added.
 */
function bp_core_exclude_pages($pages = array())
{
    // Bail if not the root blog.
    if (!bp_is_root_blog()) {
        return $pages;
    }
    $bp = buddypress();
    if (!empty($bp->pages->activate)) {
        $pages[] = $bp->pages->activate->id;
    }
    if (!empty($bp->pages->register)) {
        $pages[] = $bp->pages->register->id;
    }
    if (!empty($bp->pages->forums) && (!bp_is_active('forums') || bp_is_active('forums') && bp_forums_has_directory() && !bp_forums_is_installed_correctly())) {
        $pages[] = $bp->pages->forums->id;
    }
    /**
     * Filters specific pages that shouldn't show up on page listings.
     *
     * @since 1.5.0
     *
     * @param array $pages Array of pages to exclude.
     */
    return apply_filters('bp_core_exclude_pages', $pages);
}
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:34,代码来源:bp-core-filters.php

示例2: bp_forums_directory_forums_setup

function bp_forums_directory_forums_setup()
{
    global $bp;
    if (bp_is_forums_component() && (!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) {
        if (!bp_forums_has_directory()) {
            return false;
        }
        if (!bp_forums_is_installed_correctly()) {
            bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error');
            bp_core_redirect(bp_get_root_domain());
        }
        bp_update_is_directory(true, 'forums');
        do_action('bbpress_init');
        // Check to see if the user has posted a new topic from the forums page.
        if (isset($_POST['submit_topic']) && bp_is_active('forums')) {
            check_admin_referer('bp_forums_new_topic');
            $bp->groups->current_group = groups_get_group(array('group_id' => $_POST['topic_group_id']));
            if (!empty($bp->groups->current_group->id)) {
                // Auto join this user if they are not yet a member of this group
                if (!is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member($bp->loggedin_user->id, $bp->groups->current_group->id)) {
                    groups_join_group($bp->groups->current_group->id);
                }
                $error_message = '';
                $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
                if (!empty($forum_id)) {
                    if (empty($_POST['topic_title'])) {
                        $error_message = __('Please provide a title for your forum topic.', 'buddypress');
                    } else {
                        if (empty($_POST['topic_text'])) {
                            $error_message = __('Forum posts cannot be empty. Please enter some text.', 'buddypress');
                        }
                    }
                    if ($error_message) {
                        bp_core_add_message($error_message, 'error');
                        $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                    } else {
                        if (!($topic = groups_new_group_forum_topic($_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id))) {
                            bp_core_add_message(__('There was an error when creating the topic', 'buddypress'), 'error');
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                        } else {
                            bp_core_add_message(__('The topic was created successfully', 'buddypress'));
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/';
                        }
                    }
                    bp_core_redirect($redirect);
                } else {
                    bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                    bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
                }
            } else {
                bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
            }
        }
        do_action('bp_forums_directory_forums_setup');
        bp_core_load_template(apply_filters('bp_forums_template_directory_forums_setup', 'forums/index'));
    }
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:58,代码来源:bp-forums-screens.php

示例3: bp_core_exclude_pages

/**
 * bp_core_exclude_pages()
 *
 * Excludes specific pages from showing on page listings, for example the "Activation" page.
 *
 * @package BuddyPress Core
 * @uses bp_is_active() checks if a BuddyPress component is active.
 * @return array The list of page ID's to exclude
 */
function bp_core_exclude_pages($pages)
{
    global $bp;
    if (!empty($bp->pages->activate)) {
        $pages[] = $bp->pages->activate->id;
    }
    if (!empty($bp->pages->register)) {
        $pages[] = $bp->pages->register->id;
    }
    if (!empty($bp->pages->forums) && (!bp_is_active('forums') || bp_is_active('forums') && bp_forums_has_directory() && !bp_forums_is_installed_correctly())) {
        $pages[] = $bp->pages->forums->id;
    }
    return apply_filters('bp_core_exclude_pages', $pages);
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:23,代码来源:bp-core-filters.php

示例4: bp_core_exclude_pages

/**
 * Prevent specific pages (eg 'Activate') from showing on page listings.
 *
 * @uses bp_is_active() checks if a BuddyPress component is active.
 *
 * @param array $pages List of excluded page IDs, as passed to the
 *        'wp_list_pages_excludes' filter.
 * @return array The exclude list, with BP's pages added.
 */
function bp_core_exclude_pages($pages = array())
{
    // Bail if not the root blog
    if (!bp_is_root_blog()) {
        return $pages;
    }
    $bp = buddypress();
    if (!empty($bp->pages->activate)) {
        $pages[] = $bp->pages->activate->id;
    }
    if (!empty($bp->pages->register)) {
        $pages[] = $bp->pages->register->id;
    }
    if (!empty($bp->pages->forums) && (!bp_is_active('forums') || bp_is_active('forums') && bp_forums_has_directory() && !bp_forums_is_installed_correctly())) {
        $pages[] = $bp->pages->forums->id;
    }
    return apply_filters('bp_core_exclude_pages', $pages);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:27,代码来源:bp-core-filters.php

示例5: _e

				</div><!-- #item-header -->

				<div id="item-nav">
					<div class="item-list-tabs no-ajax" id="subnav" role="navigation">
						<ul>

							<li>
								<a href="#post-new" class="show-hide-new"><?php 
_e('New Topic', 'buddypress');
?>
</a>
							</li>

							<?php 
if (bp_forums_has_directory()) {
    ?>

								<li>
									<a href="<?php 
    bp_forums_directory_permalink();
    ?>
"><?php 
    _e('Forum Directory', 'buddypress');
    ?>
</a>
								</li>

							<?php 
}
?>
开发者ID:hscale,项目名称:webento,代码行数:30,代码来源:forum.php

示例6: bp_search_form_type_select

/**
 * Generate the basic search form as used in BP-Default's header.
 *
 * @since 1.0.0
 *
 * @return string HTML <select> element.
 */
function bp_search_form_type_select()
{
    $options = array();
    if (bp_is_active('xprofile')) {
        $options['members'] = _x('Members', 'search form', 'buddypress');
    }
    if (bp_is_active('groups')) {
        $options['groups'] = _x('Groups', 'search form', 'buddypress');
    }
    if (bp_is_active('blogs') && is_multisite()) {
        $options['blogs'] = _x('Blogs', 'search form', 'buddypress');
    }
    if (bp_is_active('forums') && bp_forums_is_installed_correctly() && bp_forums_has_directory()) {
        $options['forums'] = _x('Forums', 'search form', 'buddypress');
    }
    $options['posts'] = _x('Posts', 'search form', 'buddypress');
    // Eventually this won't be needed and a page will be built to integrate all search results.
    $selection_box = '<label for="search-which" class="accessibly-hidden">' . _x('Search these:', 'search form', 'buddypress') . '</label>';
    $selection_box .= '<select name="search-which" id="search-which" style="width: auto">';
    /**
     * Filters all of the component options available for search scope.
     *
     * @since 1.5.0
     *
     * @param array $options Array of options to add to select field.
     */
    $options = apply_filters('bp_search_form_type_select_options', $options);
    foreach ((array) $options as $option_value => $option_title) {
        $selection_box .= sprintf('<option value="%s">%s</option>', $option_value, $option_title);
    }
    $selection_box .= '</select>';
    /**
     * Filters the complete <select> input used for search scope.
     *
     * @since 1.0.0
     *
     * @param string $selection_box <select> input for selecting search scope.
     */
    return apply_filters('bp_search_form_type_select', $selection_box);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:47,代码来源:bp-core-template.php

示例7: bp_search_form_type_select

/**
 * Generates the basic search form as used in BP-Default's header.
 *
 * @global object $bp BuddyPress global settings
 * @return string HTML <select> element
 * @since 1.0
 */
function bp_search_form_type_select()
{
    global $bp;
    $options = array();
    if (bp_is_active('xprofile')) {
        $options['members'] = __('Members', 'buddypress');
    }
    if (bp_is_active('groups')) {
        $options['groups'] = __('Groups', 'buddypress');
    }
    if (bp_is_active('blogs') && is_multisite()) {
        $options['blogs'] = __('Blogs', 'buddypress');
    }
    if (bp_is_active('forums') && bp_forums_is_installed_correctly() && bp_forums_has_directory()) {
        $options['forums'] = __('Forums', 'buddypress');
    }
    $options['posts'] = __('Posts', 'buddypress');
    // Eventually this won't be needed and a page will be built to integrate all search results.
    $selection_box = '<label for="search-which" class="accessibly-hidden">' . __('Search these:', 'buddypress') . '</label>';
    $selection_box .= '<select name="search-which" id="search-which" style="width: auto">';
    $options = apply_filters('bp_search_form_type_select_options', $options);
    foreach ((array) $options as $option_value => $option_title) {
        $selection_box .= sprintf('<option value="%s">%s</option>', $option_value, $option_title);
    }
    $selection_box .= '</select>';
    return apply_filters('bp_search_form_type_select', $selection_box);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:34,代码来源:bp-core-template.php

示例8: is_legacy_forum

 /**
  * Are we looking at something that needs old forum theme compatibility?
  *
  * @since 1.7.0
  */
 public function is_legacy_forum()
 {
     // Bail if not looking at a group.
     if (!bp_is_forums_component()) {
         return;
     }
     // Forum Directory.
     if ((!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) {
         if (!bp_forums_has_directory()) {
             return false;
         }
         if (!bp_forums_is_installed_correctly()) {
             bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error');
             bp_core_redirect(bp_get_root_domain());
         }
         bp_update_is_directory(true, 'forums');
         do_action('bp_forums_directory_forums_setup');
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'directory_content'));
     }
 }
开发者ID:mawilliamson,项目名称:wordpress,代码行数:26,代码来源:bp-forums-screens.php


注:本文中的bp_forums_has_directory函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。