/** * 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)); }
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()));
/** * 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)); }
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 . '/'); }
/** * 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 ) ); }
/** * 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 . '/'); }
/** * 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)); }