本文整理汇总了PHP中bp_get_forums_root_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_forums_root_slug函数的具体用法?PHP bp_get_forums_root_slug怎么用?PHP bp_get_forums_root_slug使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_forums_root_slug函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_get_forum_permalink
/**
* Return the permalink to a given forum.
*
* @param int $forum_id Optional. Defaults to the current forum, if
* there is one.
* @return string|bool False on failure, a URL on success.
*/
function bp_get_forum_permalink($forum_id = 0)
{
global $bp;
if (bp_is_groups_component()) {
$permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/forum');
} else {
if (empty($forum_id)) {
global $topic_template;
if (isset($topic_template->forum_id)) {
$forum_id = $topic_template->forum_id;
}
}
if ($forum = bp_forums_get_forum($forum_id)) {
$permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/forum/' . $forum->forum_slug);
} else {
return false;
}
}
return apply_filters('bp_get_forum_permalink', trailingslashit($permalink));
}
示例2: bp_directory_forums_search_form
bp_directory_forums_search_form();
?>
</div>
</form>
<?php
do_action('bp_before_topics');
?>
<form action="" method="post" id="forums-directory-form" class="dir-form">
<div class="item-list-tabs" role="navigation">
<ul>
<li class="selected" id="forums-all"><a href="<?php
echo trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug());
?>
"><?php
printf(__('All Topics <span>%s</span>', 'buddypress'), bp_get_forum_topic_count());
?>
</a></li>
<?php
if (is_user_logged_in() && bp_get_forum_topic_count_for_user(bp_loggedin_user_id())) {
?>
<li id="forums-personal"><a href="<?php
echo trailingslashit(bp_loggedin_user_domain() . bp_get_forums_slug() . '/topics');
?>
"><?php
printf(__('My Topics <span>%s</span>', 'buddypress'), bp_get_forum_topic_count_for_user(bp_loggedin_user_id()));
示例3: bp_core_action_search_site
/**
* A javascript-free implementation of the search functions in BuddyPress.
*
* @param string $slug The slug to redirect to for searching.
*/
function bp_core_action_search_site($slug = '')
{
if (!bp_is_current_component(bp_get_search_slug())) {
return;
}
if (empty($_POST['search-terms'])) {
bp_core_redirect(bp_get_root_domain());
return;
}
$search_terms = stripslashes($_POST['search-terms']);
$search_which = !empty($_POST['search-which']) ? $_POST['search-which'] : '';
$query_string = '/?s=';
if (empty($slug)) {
switch ($search_which) {
case 'posts':
$slug = '';
$var = '/?s=';
// If posts aren't displayed on the front page, find the post page's slug.
if ('page' == get_option('show_on_front')) {
$page = get_post(get_option('page_for_posts'));
if (!is_wp_error($page) && !empty($page->post_name)) {
$slug = $page->post_name;
$var = '?s=';
}
}
break;
case 'blogs':
$slug = bp_is_active('blogs') ? bp_get_blogs_root_slug() : '';
break;
case 'forums':
$slug = bp_is_active('forums') ? bp_get_forums_root_slug() : '';
$query_string = '/?fs=';
break;
case 'groups':
$slug = bp_is_active('groups') ? bp_get_groups_root_slug() : '';
break;
case 'members':
default:
$slug = bp_get_members_root_slug();
break;
}
if (empty($slug) && 'posts' != $search_which) {
bp_core_redirect(bp_get_root_domain());
return;
}
}
bp_core_redirect(apply_filters('bp_core_search_site', home_url($slug . $query_string . urlencode($search_terms)), $search_terms));
}
示例4: bp_forums_filter_tag_link
function bp_forums_filter_tag_link($link, $tag, $page, $context)
{
global $bp;
return apply_filters('bp_forums_filter_tag_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/tag/' . $tag . '/');
}
示例5: bp_get_forum_permalink
/**
* Return the permalink to a given forum.
*
* @param int $forum_id Optional. Defaults to the current forum, if
* there is one.
* @return string|bool False on failure, a URL on success.
*/
function bp_get_forum_permalink( $forum_id = 0 ) {
global $bp;
if ( bp_is_groups_component() ) {
$permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/forum' );
} else {
if ( empty( $forum_id ) ) {
global $topic_template;
if ( isset( $topic_template->forum_id ) )
$forum_id = $topic_template->forum_id;
}
if ( $forum = bp_forums_get_forum( $forum_id ) )
$permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/forum/' . $forum->forum_slug );
else
return false;
}
/**
* Filters the permalink to a given forum.
*
* @since BuddyPress (1.0.0)
*
* @param string $value Peramlink to the given forum.
*/
return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink ) );
}
示例6: bp_forums_filter_tag_link
/**
* Get a link for a forum topic tags directory.
*
* @param string $link Link passed from filter.
* @param string $tag Name of the tag.
* @param string $page Page number, passed from the filter.
* @param string $context Passed from the filter but unused here.
* @return string Link of the form http://example.com/forums/tag/tagname/.
*/
function bp_forums_filter_tag_link($link, $tag, $page, $context)
{
/**
* Filters the link for a forum topic tags directory.
*
* @since 1.1.0
*
* @param string $value Link for the forum topic tag directory.
*/
return apply_filters('bp_forums_filter_tag_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/tag/' . $tag . '/');
}
示例7: bp_core_action_search_site
/**
* A javascript free implementation of the search functions in BuddyPress
*
* @package BuddyPress Core
* @global object $bp Global BuddyPress settings object
* @param string $slug The slug to redirect to for searching.
*/
function bp_core_action_search_site($slug = '')
{
global $bp;
if (!bp_is_current_component(bp_get_search_slug())) {
return;
}
if (empty($_POST['search-terms'])) {
bp_core_redirect(bp_get_root_domain());
return;
}
$search_terms = stripslashes($_POST['search-terms']);
$search_which = !empty($_POST['search-which']) ? $_POST['search-which'] : '';
$query_string = '/?s=';
if (empty($slug)) {
switch ($search_which) {
case 'posts':
$slug = '';
$var = '/?s=';
break;
case 'blogs':
$slug = bp_is_active('blogs') ? bp_get_blogs_root_slug() : '';
break;
case 'forums':
$slug = bp_is_active('forums') ? bp_get_forums_root_slug() : '';
$query_string = '/?fs=';
break;
case 'groups':
$slug = bp_is_active('groups') ? bp_get_groups_root_slug() : '';
break;
case 'members':
default:
$slug = bp_get_members_root_slug();
break;
}
if (empty($slug) && 'posts' != $search_which) {
bp_core_redirect(bp_get_root_domain());
return;
}
}
bp_core_redirect(apply_filters('bp_core_search_site', home_url($slug . $query_string . urlencode($search_terms)), $search_terms));
}