Esempio n. 1
1
function bphelp_pbpp_redirect()
{
    global $bp;
    //IMPORTANT: Do not alter the following line.
    $bphelp_my_redirect_slug = get_option('bphelp-my-redirect-slug', 'register');
    if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bbp_is_single_forum() || bbp_is_single_topic() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_members_component() || bp_is_profile_component()) {
        if (!is_user_logged_in()) {
            bp_core_redirect(get_option('home') . '/' . $bphelp_my_redirect_slug);
        }
    }
}
Esempio n. 2
0
    function bbPress_head_scripts()
    {
        // Put some scripts in the header, like AJAX url for wp-lists
        if (bbp_is_single_topic()) {
            ?>
	
		<script type='text/javascript'>
			/* <![CDATA[ */
			var ajaxurl = '<?php 
            echo admin_url('admin-ajax.php');
            ?>
';
			/* ]]> */
		</script>
	
		<?php 
        } elseif (bbp_is_single_user_edit()) {
            ?>
	
		<script type="text/javascript" charset="utf-8">
			if ( window.location.hash == '#password' ) {
				document.getElementById('pass1').focus();
			}
		</script>
	
		<?php 
        }
    }
Esempio n. 3
0
/**
 * The main reply loop. WordPress makes this easy for us
 *
 * @since bbPress (r2553)
 *
 * @param mixed $args All the arguments supported by {@link WP_Query}
 * @uses bbp_is_user_bozo() To add the bozo post status
 * @uses bbp_show_lead_topic() Are we showing the topic as a lead?
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses bbp_is_query_name() To check if we are getting replies for a widget
 * @uses get_option() To get the replies per page option
 * @uses bbp_get_paged() To get the current page value
 * @uses current_user_can() To check if the current user is capable of editing
 *                           others' replies
 * @uses WP_Query To make query and get the replies
 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks
 * @uses get_permalink() To get the permalink
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_replies_pagination' with the pagination args
 * @uses paginate_links() To paginate the links
 * @uses apply_filters() Calls 'bbp_has_replies' with
 *                        bbPres::reply_query::have_posts()
 *                        and bbPres::reply_query
 * @return object Multidimensional array of reply information
 */
function bbp_has_replies($args = '')
{
    global $wp_rewrite;
    // What are the default allowed statuses (based on user caps)
    if (bbp_get_view_all('edit_others_replies')) {
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id());
    } else {
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id());
    }
    // Add the bozo status if user is a bozo
    if (bbp_is_user_bozo()) {
        $post_statuses[] = bbp_get_bozo_status_id();
    }
    $default_reply_search = !empty($_REQUEST['rs']) ? $_REQUEST['rs'] : false;
    $default_post_parent = bbp_is_single_topic() ? bbp_get_topic_id() : 'any';
    $default_post_type = bbp_is_single_topic() && bbp_show_lead_topic() ? bbp_get_reply_post_type() : array(bbp_get_topic_post_type(), bbp_get_reply_post_type());
    $default_post_status = join(',', $post_statuses);
    // Default query args
    $default = array('post_type' => $default_post_type, 'post_parent' => $default_post_parent, 'post_status' => $default_post_status, 'posts_per_page' => bbp_get_replies_per_page(), 'paged' => bbp_get_paged(), 'orderby' => 'date', 'order' => 'ASC', 's' => $default_reply_search);
    // Set up topic variables
    $bbp_r = bbp_parse_args($args, $default, 'has_replies');
    // Extract the query variables
    extract($bbp_r);
    // Get bbPress
    $bbp = bbpress();
    // Call the query
    $bbp->reply_query = new WP_Query($bbp_r);
    // Add pagination values to query object
    $bbp->reply_query->posts_per_page = $posts_per_page;
    $bbp->reply_query->paged = $paged;
    // Only add pagination if query returned results
    if ((int) $bbp->reply_query->found_posts && (int) $bbp->reply_query->posts_per_page) {
        // If pretty permalinks are enabled, make our pagination pretty
        if ($wp_rewrite->using_permalinks()) {
            // Page or single
            if (is_page() || is_single()) {
                $base = get_permalink();
                // Topic
            } else {
                $base = get_permalink(bbp_get_topic_id());
            }
            $base = trailingslashit($base) . user_trailingslashit($wp_rewrite->pagination_base . '/%#%/');
            // Unpretty permalinks
        } else {
            $base = add_query_arg('paged', '%#%');
        }
        // Pagination settings with filter
        $bbp_replies_pagination = apply_filters('bbp_replies_pagination', array('base' => $base, 'format' => '', 'total' => ceil((int) $bbp->reply_query->found_posts / (int) $posts_per_page), 'current' => (int) $bbp->reply_query->paged, 'prev_text' => '&larr;', 'next_text' => '&rarr;', 'mid_size' => 1, 'add_args' => bbp_get_view_all() ? array('view' => 'all') : false));
        // Add pagination to query object
        $bbp->reply_query->pagination_links = paginate_links($bbp_replies_pagination);
        // Remove first page from pagination
        if ($wp_rewrite->using_permalinks()) {
            $bbp->reply_query->pagination_links = str_replace($wp_rewrite->pagination_base . '/1/', '', $bbp->reply_query->pagination_links);
        } else {
            $bbp->reply_query->pagination_links = str_replace('&#038;paged=1', '', $bbp->reply_query->pagination_links);
        }
    }
    // Return object
    return apply_filters('bbp_has_replies', $bbp->reply_query->have_posts(), $bbp->reply_query);
}
Esempio n. 4
0
 static function update_views()
 {
     if (bbp_is_single_topic() && ($topic_id = bbp_get_topic_id())) {
         $count = self::get_views($topic_id);
         $count++;
         update_post_meta($topic_id, 'topic_view_count', $count);
     }
 }
Esempio n. 5
0
/**
 * Possibly intercept the template being loaded
 *
 * Listens to the 'template_include' filter and waits for any bbPress specific
 * template condition to be met. If one is met and the template file exists,
 * it will be used; otherwise 
 *
 * Note that the _edit() checks are ahead of their counterparts, to prevent them
 * from being stomped on accident.
 *
 * @since bbPress (r3032)
 *
 * @param string $template
 *
 * @uses bbp_is_single_user() To check if page is single user
 * @uses bbp_get_single_user_template() To get user template
 * @uses bbp_is_single_user_edit() To check if page is single user edit
 * @uses bbp_get_single_user_edit_template() To get user edit template
 * @uses bbp_is_single_view() To check if page is single view
 * @uses bbp_get_single_view_template() To get view template
 * @uses bbp_is_search() To check if page is search
 * @uses bbp_get_search_template() To get search template
 * @uses bbp_is_forum_edit() To check if page is forum edit
 * @uses bbp_get_forum_edit_template() To get forum edit template
 * @uses bbp_is_topic_merge() To check if page is topic merge
 * @uses bbp_get_topic_merge_template() To get topic merge template
 * @uses bbp_is_topic_split() To check if page is topic split
 * @uses bbp_get_topic_split_template() To get topic split template
 * @uses bbp_is_topic_edit() To check if page is topic edit
 * @uses bbp_get_topic_edit_template() To get topic edit template
 * @uses bbp_is_reply_move() To check if page is reply move
 * @uses bbp_get_reply_move_template() To get reply move template
 * @uses bbp_is_reply_edit() To check if page is reply edit
 * @uses bbp_get_reply_edit_template() To get reply edit template
 * @uses bbp_set_theme_compat_template() To set the global theme compat template
 *
 * @return string The path to the template file that is being used
 */
function bbp_template_include_theme_supports($template = '')
{
    // Editing a user
    if (bbp_is_single_user_edit() && ($new_template = bbp_get_single_user_edit_template())) {
        // User favorites
    } elseif (bbp_is_favorites() && ($new_template = bbp_get_favorites_template())) {
        // User favorites
    } elseif (bbp_is_subscriptions() && ($new_template = bbp_get_subscriptions_template())) {
        // Viewing a user
    } elseif (bbp_is_single_user() && ($new_template = bbp_get_single_user_template())) {
        // Single View
    } elseif (bbp_is_single_view() && ($new_template = bbp_get_single_view_template())) {
        // Search
    } elseif (bbp_is_search() && ($new_template = bbp_get_search_template())) {
        // Forum edit
    } elseif (bbp_is_forum_edit() && ($new_template = bbp_get_forum_edit_template())) {
        // Single Forum
    } elseif (bbp_is_single_forum() && ($new_template = bbp_get_single_forum_template())) {
        // Forum Archive
    } elseif (bbp_is_forum_archive() && ($new_template = bbp_get_forum_archive_template())) {
        // Topic merge
    } elseif (bbp_is_topic_merge() && ($new_template = bbp_get_topic_merge_template())) {
        // Topic split
    } elseif (bbp_is_topic_split() && ($new_template = bbp_get_topic_split_template())) {
        // Topic edit
    } elseif (bbp_is_topic_edit() && ($new_template = bbp_get_topic_edit_template())) {
        // Single Topic
    } elseif (bbp_is_single_topic() && ($new_template = bbp_get_single_topic_template())) {
        // Topic Archive
    } elseif (bbp_is_topic_archive() && ($new_template = bbp_get_topic_archive_template())) {
        // Reply move
    } elseif (bbp_is_reply_move() && ($new_template = bbp_get_reply_move_template())) {
        // Editing a reply
    } elseif (bbp_is_reply_edit() && ($new_template = bbp_get_reply_edit_template())) {
        // Single Reply
    } elseif (bbp_is_single_reply() && ($new_template = bbp_get_single_reply_template())) {
        // Editing a topic tag
    } elseif (bbp_is_topic_tag_edit() && ($new_template = bbp_get_topic_tag_edit_template())) {
        // Viewing a topic tag
    } elseif (bbp_is_topic_tag() && ($new_template = bbp_get_topic_tag_template())) {
    }
    // A bbPress template file was located, so override the WordPress template
    // and use it to switch off bbPress's theme compatibility.
    if (!empty($new_template)) {
        $template = bbp_set_template_included($new_template);
    }
    return apply_filters('bbp_template_include_theme_supports', $template);
}
Esempio n. 6
0
 public static function comments_open($open, $post_id)
 {
     // if ( $open )
     // 	return $open;
     if (get_post_type($post_id) != bbp_get_topic_post_type()) {
         return $open;
     }
     $use_comments = (bool) bbpresskr()->forum_option('use_comments', $post_id);
     if (strpos($_SERVER['SCRIPT_FILENAME'], 'wp-comments-post.php') !== false && !empty($_POST['comment_post_ID']) && !empty($_POST['comment'])) {
         return $use_comments;
     }
     if (bbp_is_single_topic()) {
         return $use_comments;
     }
     return $open;
 }
function bbpress_hl_add_buttons()
{
    global $wp_sh_allowed_str, $wp_sh_setting_opt;
    if (bbp_is_single_forum() || bbp_is_single_topic() || bbp_is_topic_edit() || bbp_is_reply_edit()) {
        if (bbp_is_single_forum()) {
            $textarea_id = "bbp_topic_content";
        } elseif (bbp_is_topic_edit()) {
            $textarea_id = "bbp_topic_content";
        } elseif (bbp_is_reply_edit()) {
            $textarea_id = "bbp_reply_content";
        } elseif (bbp_is_single_topic()) {
            $textarea_id = "bbp_reply_content";
        }
        echo "<div class=\"bbpress_highlight\">";
        if ($wp_sh_setting_opt['bbpress_hl_description_before_enable'] == 1) {
            $wp_sh_bbpress_hl_description_before = wp_sh_valid_text(get_option('wp_sh_bbpress_hl_description_before'), $wp_sh_allowed_str);
            if ($wp_sh_bbpress_hl_description_before == "invalid") {
                $wp_sh_bbpress_hl_description_before = wp_sh_default_setting_value('bbp_desc');
            }
            echo "<p>" . str_replace("<pre>", "&lt;pre&gt;", $wp_sh_bbpress_hl_description_before) . "</p>";
        }
        if ($wp_sh_setting_opt['bbpress_hl_bt_tag'] == "shortcode") {
            $tag = "shorcode";
        } else {
            $tag = "pre";
        }
        echo "<div class=\"bbpress_highlight_button\">";
        if ($wp_sh_setting_opt['lib_version'] == '3.0') {
            $languages = get_option('wp_sh_language3');
        } elseif ($wp_sh_setting_opt['lib_version'] == '2.1') {
            $languages = get_option('wp_sh_language2');
        }
        $gutter = $wp_sh_setting_opt['gutter'];
        if (is_array($languages)) {
            asort($languages);
            foreach ($languages as $key => $val) {
                if ($val[1] == 'true' || $val[1] == 'added') {
                    echo "<a href=\"javascript:void(0);\" onclick=\"surroundHTML('" . $key . "','" . $textarea_id . "','" . $gutter . "','" . $wp_sh_setting_opt['first_line'] . "','" . $tag . "','0');\">" . $val[0] . "</a> | ";
                }
            }
            unset($val);
        }
        echo "</div>";
        echo "</div>";
    }
}
Esempio n. 8
0
/**
 * Possibly intercept the template being loaded
 *
 * Listens to the 'template_include' filter and waits for any bbPress specific
 * template condition to be met. If one is met and the template file exists,
 * it will be used; otherwise 
 *
 * Note that the _edit() checks are ahead of their counterparts, to prevent them
 * from being stomped on accident.
 *
 * @since bbPress (r3032)
 *
 * @param string $template
 *
 * @uses bbp_is_single_user() To check if page is single user
 * @uses bbp_get_single_user_template() To get user template
 * @uses bbp_is_single_user_edit() To check if page is single user edit
 * @uses bbp_get_single_user_edit_template() To get user edit template
 * @uses bbp_is_single_view() To check if page is single view
 * @uses bbp_get_single_view_template() To get view template
 * @uses bbp_is_forum_edit() To check if page is forum edit
 * @uses bbp_get_forum_edit_template() To get forum edit template
 * @uses bbp_is_topic_merge() To check if page is topic merge
 * @uses bbp_get_topic_merge_template() To get topic merge template
 * @uses bbp_is_topic_split() To check if page is topic split
 * @uses bbp_get_topic_split_template() To get topic split template
 * @uses bbp_is_topic_edit() To check if page is topic edit
 * @uses bbp_get_topic_edit_template() To get topic edit template
 * @uses bbp_is_reply_edit() To check if page is reply edit
 * @uses bbp_get_reply_edit_template() To get reply edit template
 * @uses bbp_set_theme_compat_template() To set the global theme compat template
 *
 * @return string The path to the template file that is being used
 */
function bbp_template_include_theme_supports($template = '')
{
    // Editing a user
    if (bbp_is_single_user_edit() && ($new_template = bbp_get_single_user_edit_template())) {
        // User favorites
    } elseif (bbp_is_favorites() && ($new_template = bbp_get_favorites_template())) {
        // User favorites
    } elseif (bbp_is_subscriptions() && ($new_template = bbp_get_subscriptions_template())) {
        // Viewing a user
    } elseif (bbp_is_single_user() && ($new_template = bbp_get_single_user_template())) {
        // Single View
    } elseif (bbp_is_single_view() && ($new_template = bbp_get_single_view_template())) {
        // Forum edit
    } elseif (bbp_is_forum_edit() && ($new_template = bbp_get_forum_edit_template())) {
        // Single Forum
    } elseif (bbp_is_single_forum() && ($new_template = bbp_get_single_forum_template())) {
        // Forum Archive
    } elseif (bbp_is_forum_archive() && ($new_template = bbp_get_forum_archive_template())) {
        // Topic merge
    } elseif (bbp_is_topic_merge() && ($new_template = bbp_get_topic_merge_template())) {
        // Topic split
    } elseif (bbp_is_topic_split() && ($new_template = bbp_get_topic_split_template())) {
        // Topic edit
    } elseif (bbp_is_topic_edit() && ($new_template = bbp_get_topic_edit_template())) {
        // Single Topic
    } elseif (bbp_is_single_topic() && ($new_template = bbp_get_single_topic_template())) {
        // Topic Archive
    } elseif (bbp_is_topic_archive() && ($new_template = bbp_get_topic_archive_template())) {
        // Editing a reply
    } elseif (bbp_is_reply_edit() && ($new_template = bbp_get_reply_edit_template())) {
        // Single Reply
    } elseif (bbp_is_single_reply() && ($new_template = bbp_get_single_reply_template())) {
        // Editing a topic tag
    } elseif (bbp_is_topic_tag_edit() && ($new_template = bbp_get_topic_tag_edit_template())) {
        // Viewing a topic tag
    } elseif (bbp_is_topic_tag() && ($new_template = bbp_get_topic_tag_template())) {
    }
    // bbPress template file exists
    if (!empty($new_template)) {
        // Override the WordPress template with a bbPress one
        $template = $new_template;
        // @see: bbp_template_include_theme_compat()
        bbpress()->theme_compat->bbpress_template = true;
    }
    return apply_filters('bbp_template_include_theme_supports', $template);
}
Esempio n. 9
0
 static function nav_menu_css_class($classes, $item, $args, $depth)
 {
     if ($item->object == bbp_get_forum_post_type() && is_bbpress()) {
         if (bbp_is_topic_edit() || bbp_is_single_topic()) {
             $forum_id = bbp_get_topic_forum_id();
             if ($forum_id == $item->object_id) {
                 $classes[] = 'current-menu-parent';
                 $classes[] = 'current-' . bbp_get_topic_post_type() . '-parent';
             } elseif ($ancestors = self::forum_ancestors($forum_id, array())) {
                 if (in_array($item->object_id, $ancestors)) {
                     $classes[] = 'current-menu-ancestor';
                     $classes[] = 'current-' . bbp_get_topic_post_type() . '-ancestor';
                 }
             }
         } elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
             $forum_id = bbp_get_reply_forum_id();
         }
     }
     return $classes;
 }
Esempio n. 10
0
/**
 * User favorites link
 *
 * Return the link to make a topic favorite/remove a topic from
 * favorites
 *
 * @since bbPress (r2652)
 *
 * @param mixed $args This function supports these arguments:
 *  - subscribe: Favorite text
 *  - unsubscribe: Unfavorite text
 *  - user_id: User id
 *  - topic_id: Topic id
 *  - before: Before the link
 *  - after: After the link
 * @param int $user_id Optional. User id
 * @param int $topic_id Optional. Topic id
 * @param bool $wrap Optional. If you want to wrap the link in <span id="favorite-toggle">. See ajax_favorite()
 * @uses bbp_get_user_id() To get the user id
 * @uses current_user_can() If the current user can edit the user
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_is_user_favorite() To check if the topic is user's favorite
 * @uses bbp_get_favorites_permalink() To get the favorites permalink
 * @uses bbp_get_topic_permalink() To get the topic permalink
 * @uses bbp_is_favorites() Is it the favorites page?
 * @uses apply_filters() Calls 'bbp_get_user_favorites_link' with the
 *                        html, add args, remove args, user & topic id
 * @return string User favorites link
 */
function stachestack_bbp_get_user_favorites_link($args = '', $user_id = 0, $wrap = true)
{
    if (!bbp_is_favorites_active()) {
        return false;
    }
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('favorite' => __('Favorite', 'bbpress'), 'favorited' => __('Favorited', 'bbpress'), 'user_id' => 0, 'topic_id' => 0, 'before' => '', 'after' => ''), 'get_user_favorites_link');
    // Validate user and topic ID's
    $user_id = bbp_get_user_id($r['user_id'], true, true);
    $topic_id = bbp_get_topic_id($r['topic_id']);
    if (empty($user_id) || empty($topic_id)) {
        return false;
    }
    // No link if you can't edit yourself
    if (!current_user_can('edit_user', (int) $user_id)) {
        return false;
    }
    // Decide which link to show
    $is_fav = bbp_is_user_favorite($user_id, $topic_id);
    if (!empty($is_fav)) {
        $text = $r['favorited'];
        $query_args = array('action' => 'bbp_favorite_remove', 'topic_id' => $topic_id);
    } else {
        $text = $r['favorite'];
        $query_args = array('action' => 'bbp_favorite_add', 'topic_id' => $topic_id);
    }
    // Create the link based where the user is and if the topic is
    // already the user's favorite
    if (bbp_is_favorites()) {
        $permalink = bbp_get_favorites_permalink($user_id);
    } elseif (bbp_is_single_topic() || bbp_is_single_reply()) {
        $permalink = bbp_get_topic_permalink($topic_id);
    } else {
        $permalink = get_permalink();
    }
    $url = esc_url(wp_nonce_url(add_query_arg($query_args, $permalink), 'toggle-favorite_' . $topic_id));
    $sub = $is_fav ? ' class="is-favorite"' : '';
    $html = sprintf('%s<span id="favorite-%d"  %s><a href="%s" class="btn btn-success btn-xs favorite-toggle" data-topic="%d">%s</a></span>%s', $r['before'], $topic_id, $sub, $url, $topic_id, $text, $r['after']);
    // Initial output is wrapped in a span, ajax output is hooked to this
    if (!empty($wrap)) {
        $html = '<span id="favorite-toggle">' . $html . '</span>';
    }
    // Return the link
    return apply_filters('bbp_get_user_favorites_link', $html, $r, $user_id, $topic_id);
}
Esempio n. 11
0
 /**
  * Runs through the various bbPress conditional tags to check the current page being viewed.  Once
  * a condition is met, add items to the $items array.
  *
  * @since  0.6.0
  * @access public
  * @return void
  */
 public function do_trail_items()
 {
     /* Add the network and site home links. */
     $this->do_network_home_link();
     $this->do_site_home_link();
     /* Get the forum post type object. */
     $post_type_object = get_post_type_object(bbp_get_forum_post_type());
     /* If not viewing the forum root/archive page and a forum archive exists, add it. */
     if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
         $this->items[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>';
     }
     /* If viewing the forum root/archive. */
     if (bbp_is_forum_archive()) {
         if (true === $this->args['show_title']) {
             $this->items[] = bbp_get_forum_archive_title();
         }
     } elseif (bbp_is_topic_archive()) {
         if (true === $this->args['show_title']) {
             $this->items[] = bbp_get_topic_archive_title();
         }
     } elseif (bbp_is_topic_tag()) {
         if (true === $this->args['show_title']) {
             $this->items[] = bbp_get_topic_tag_name();
         }
     } elseif (bbp_is_topic_tag_edit()) {
         $this->items[] = '<a href="' . bbp_get_topic_tag_link() . '">' . bbp_get_topic_tag_name() . '</a>';
         if (true === $this->args['show_title']) {
             $this->items[] = __('Edit', 'breadcrumb-trail');
         }
     } elseif (bbp_is_single_view()) {
         if (true === $this->args['show_title']) {
             $this->items[] = bbp_get_view_title();
         }
     } elseif (bbp_is_single_topic()) {
         /* Get the queried topic. */
         $topic_id = get_queried_object_id();
         /* Get the parent items for the topic, which would be its forum (and possibly forum grandparents). */
         $this->do_post_parents(bbp_get_topic_forum_id($topic_id));
         /* If viewing a split, merge, or edit topic page, show the link back to the topic.  Else, display topic title. */
         if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
             $this->items[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>';
         } elseif (true === $this->args['show_title']) {
             $this->items[] = bbp_get_topic_title($topic_id);
         }
         /* If viewing a topic split page. */
         if (bbp_is_topic_split() && true === $this->args['show_title']) {
             $this->items[] = __('Split', 'breadcrumb-trail');
         } elseif (bbp_is_topic_merge() && true === $this->args['show_title']) {
             $this->items[] = __('Merge', 'breadcrumb-trail');
         } elseif (bbp_is_topic_edit() && true === $this->args['show_title']) {
             $this->items[] = __('Edit', 'breadcrumb-trail');
         }
     } elseif (bbp_is_single_reply()) {
         /* Get the queried reply object ID. */
         $reply_id = get_queried_object_id();
         /* Get the parent items for the reply, which should be its topic. */
         $this->do_post_parents(bbp_get_reply_topic_id($reply_id));
         /* If viewing a reply edit page, link back to the reply. Else, display the reply title. */
         if (bbp_is_reply_edit()) {
             $this->items[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>';
             if (true === $this->args['show_title']) {
                 $this->items[] = __('Edit', 'breadcrumb-trail');
             }
         } elseif (true === $this->args['show_title']) {
             $this->items[] = bbp_get_reply_title($reply_id);
         }
     } elseif (bbp_is_single_forum()) {
         /* Get the queried forum ID and its parent forum ID. */
         $forum_id = get_queried_object_id();
         $forum_parent_id = bbp_get_forum_parent_id($forum_id);
         /* If the forum has a parent forum, get its parent(s). */
         if (0 !== $forum_parent_id) {
             $this->do_post_parents($forum_parent_id);
         }
         /* Add the forum title to the end of the trail. */
         if (true === $this->args['show_title']) {
             $this->items[] = bbp_get_forum_title($forum_id);
         }
     } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
         if (bbp_is_single_user_edit()) {
             $this->items[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>';
             if (true === $this->args['show_title']) {
                 $this->items[] = __('Edit', 'breadcrumb-trail');
             }
         } elseif (true === $this->args['show_title']) {
             $this->items[] = bbp_get_displayed_user_field('display_name');
         }
     }
     /* Return the bbPress breadcrumb trail items. */
     $this->items = apply_filters('breadcrumb_trail_get_bbpress_items', $this->items, $this->args);
 }
Esempio n. 12
0
/**
 * Return the topic pagination count
 *
 * @since bbPress (r2519)
 *
 * @uses bbp_number_format() To format the number value
 * @uses bbp_show_lead_topic() Are we showing the topic as a lead?
 * @uses apply_filters() Calls 'bbp_get_topic_pagination_count' with the
 *                        pagination count
 * @return string Topic pagination count
 */
function bbp_get_topic_pagination_count()
{
    $bbp = bbpress();
    // Define local variable(s)
    $retstr = '';
    // Set pagination values
    $start_num = intval(($bbp->reply_query->paged - 1) * $bbp->reply_query->posts_per_page) + 1;
    $from_num = bbp_number_format($start_num);
    $to_num = bbp_number_format($start_num + ($bbp->reply_query->posts_per_page - 1) > $bbp->reply_query->found_posts ? $bbp->reply_query->found_posts : $start_num + ($bbp->reply_query->posts_per_page - 1));
    $total_int = (int) $bbp->reply_query->found_posts;
    $total = bbp_number_format($total_int);
    // We are threading replies
    if (bbp_thread_replies() && bbp_is_single_topic()) {
        return;
        $walker = new BBP_Walker_Reply();
        $threads = (int) $walker->get_number_of_root_elements($bbp->reply_query->posts);
        // Adjust for topic
        $threads--;
        $retstr = sprintf(_n('Viewing %1$s reply thread', 'Viewing %1$s reply threads', $threads, 'bbbpress'), bbp_number_format($threads));
        // We are not including the lead topic
    } elseif (bbp_show_lead_topic()) {
        // Several replies in a topic with a single page
        if (empty($to_num)) {
            $retstr = sprintf(_n('Viewing %1$s reply', 'Viewing %1$s replies', $total_int, 'bbpress'), $total);
            // Several replies in a topic with several pages
        } else {
            $retstr = sprintf(_n('Viewing %2$s replies (of %4$s total)', 'Viewing %1$s replies - %2$s through %3$s (of %4$s total)', $bbp->reply_query->post_count, 'bbpress'), $bbp->reply_query->post_count, $from_num, $to_num, $total);
        }
        // We are including the lead topic
    } else {
        // Several posts in a topic with a single page
        if (empty($to_num)) {
            $retstr = sprintf(_n('Viewing %1$s post', 'Viewing %1$s posts', $total_int, 'bbpress'), $total);
            // Several posts in a topic with several pages
        } else {
            $retstr = sprintf(_n('Viewing %2$s post (of %4$s total)', 'Viewing %1$s posts - %2$s through %3$s (of %4$s total)', $bbp->reply_query->post_count, 'bbpress'), $bbp->reply_query->post_count, $from_num, $to_num, $total);
        }
    }
    // Filter and return
    return apply_filters('bbp_get_topic_pagination_count', esc_html($retstr));
}
Esempio n. 13
0
 protected function _bbpress_items()
 {
     $item = array();
     $post_type_object = get_post_type_object(bbp_get_forum_post_type());
     if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
         $item[] = '<span typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '"  property="v:title" rel="v:url"><span>' . bbp_get_forum_archive_title() . '</span></a></span>';
     }
     if (bbp_is_forum_archive()) {
         $item[] = bbp_get_forum_archive_title();
     } elseif (bbp_is_topic_archive()) {
         $item[] = bbp_get_topic_archive_title();
     } elseif (bbp_is_single_view()) {
         $item[] = bbp_get_view_title();
     } elseif (bbp_is_single_topic()) {
         $topic_id = get_queried_object_id();
         $item = array_merge($item, $this->_get_parents(bbp_get_topic_forum_id($topic_id)));
         if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
             $item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_topic_permalink($topic_id) . '"  property="v:title" rel="v:url"><span>' . bbp_get_topic_title($topic_id) . '</span></a></span>';
         } else {
             $item[] = bbp_get_topic_title($topic_id);
         }
         if (bbp_is_topic_split()) {
             $item[] = __('Split', DH_DOMAIN);
         } elseif (bbp_is_topic_merge()) {
             $item[] = __('Merge', DH_DOMAIN);
         } elseif (bbp_is_topic_edit()) {
             $item[] = __('Edit', DH_DOMAIN);
         }
     } elseif (bbp_is_single_reply()) {
         $reply_id = get_queried_object_id();
         $item = array_merge($item, $this->_get_parents(bbp_get_reply_topic_id($reply_id)));
         if (!bbp_is_reply_edit()) {
             $item[] = bbp_get_reply_title($reply_id);
         } else {
             $item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_reply_url($reply_id) . '"  property="v:title" rel="v:url"><span>' . bbp_get_reply_title($reply_id) . '</span></a></span>';
             $item[] = __('Edit', DH_DOMAIN);
         }
     } elseif (bbp_is_single_forum()) {
         $forum_id = get_queried_object_id();
         $forum_parent_id = bbp_get_forum_parent_id($forum_id);
         if (0 !== $forum_parent_id) {
             $item = array_merge($item, $this->_get_parents($forum_parent_id));
         }
         $item[] = bbp_get_forum_title($forum_id);
     } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
         if (bbp_is_single_user_edit()) {
             $item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_user_profile_url() . '"  property="v:title" rel="v:url" ><span>' . bbp_get_displayed_user_field('display_name') . '</span></a></span>';
             $item[] = __('Edit', DH_DOMAIN);
         } else {
             $item[] = bbp_get_displayed_user_field('display_name');
         }
     }
     return $item;
 }
Esempio n. 14
0
/**
 * Return the forum id
 *
 * @since bbPress (r2464)
 *
 * @param $forum_id Optional. Used to check emptiness
 * @uses bbPress::forum_query::in_the_loop To check if we're in the loop
 * @uses bbPress::forum_query::post::ID To get the forum id
 * @uses WP_Query::post::ID To get the forum id
 * @uses bbp_is_forum() To check if the search result is a forum
 * @uses bbp_is_single_forum() To check if it's a forum page
 * @uses bbp_is_single_topic() To check if it's a topic page
 * @uses bbp_get_topic_forum_id() To get the topic forum id
 * @uses get_post_field() To get the post's post type
 * @uses apply_filters() Calls 'bbp_get_forum_id' with the forum id and
 *                        supplied forum id
 * @return int The forum id
 */
function bbp_get_forum_id($forum_id = 0)
{
    global $wp_query;
    $bbp = bbpress();
    // Easy empty checking
    if (!empty($forum_id) && is_numeric($forum_id)) {
        $bbp_forum_id = $forum_id;
        // Currently inside a forum loop
    } elseif (!empty($bbp->forum_query->in_the_loop) && isset($bbp->forum_query->post->ID)) {
        $bbp_forum_id = $bbp->forum_query->post->ID;
        // Currently inside a search loop
    } elseif (!empty($bbp->search_query->in_the_loop) && isset($bbp->search_query->post->ID) && bbp_is_forum($bbp->search_query->post->ID)) {
        $bbp_forum_id = $bbp->search_query->post->ID;
        // Currently viewing a forum
    } elseif ((bbp_is_single_forum() || bbp_is_forum_edit()) && !empty($bbp->current_forum_id)) {
        $bbp_forum_id = $bbp->current_forum_id;
        // Currently viewing a forum
    } elseif ((bbp_is_single_forum() || bbp_is_forum_edit()) && isset($wp_query->post->ID)) {
        $bbp_forum_id = $wp_query->post->ID;
        // Currently viewing a topic
    } elseif (bbp_is_single_topic()) {
        $bbp_forum_id = bbp_get_topic_forum_id();
        // Fallback
    } else {
        $bbp_forum_id = 0;
    }
    return (int) apply_filters('bbp_get_forum_id', (int) $bbp_forum_id, $forum_id);
}
Esempio n. 15
0
				<div class="cb-cat-header<?php 
if ($cb_theme_style == 'cb_boxed') {
    echo ' wrap';
}
?>
" style="border-bottom-color:<?php 
echo $cb_bbpress_global_color;
?>
;">
                    
                    <h1 id="cb-cat-title"><?php 
echo $cb_title;
?>
</h1>
                    <p><?php 
if ($cb_forum_id != 0 && bbp_is_single_topic() == false && bbp_is_single_reply() == false) {
    bbp_forum_content();
}
?>
</p>
                        
                </div>

                <?php 
if ($cb_user_page != NULL) {
    echo cb_bbp_author_details($cb_current_user);
}
?>

                <?php 
if ($cb_forum_id != 0 && $cb_breadcrumbs == 'on') {
Esempio n. 16
0
/**
 * Custom page title for bbPress pages
 *
 * @since bbPress (r2788)
 *
 * @param string $title Optional. The title (not used).
 * @param string $sep Optional, default is '&raquo;'. How to separate the
 *                     various items within the page title.
 * @param string $seplocation Optional. Direction to display title, 'right'.
 * @uses bbp_is_single_user() To check if it's a user profile page
 * @uses bbp_is_single_user_edit() To check if it's a user profile edit page
 * @uses bbp_is_user_home() To check if the profile page is of the current user
 * @uses get_query_var() To get the user id
 * @uses get_userdata() To get the user data
 * @uses bbp_is_single_forum() To check if it's a forum
 * @uses bbp_get_forum_title() To get the forum title
 * @uses bbp_is_single_topic() To check if it's a topic
 * @uses bbp_get_topic_title() To get the topic title
 * @uses bbp_is_single_reply() To check if it's a reply
 * @uses bbp_get_reply_title() To get the reply title
 * @uses is_tax() To check if it's the tag page
 * @uses get_queried_object() To get the queried object
 * @uses bbp_is_single_view() To check if it's a view
 * @uses bbp_get_view_title() To get the view title
 * @uses apply_filters() Calls 'bbp_raw_title' with the title
 * @uses apply_filters() Calls 'bbp_profile_page_wp_title' with the title,
 *                        separator and separator location
 * @return string The tite
 */
function bbp_title($title = '', $sep = '&raquo;', $seplocation = '')
{
    // Title array
    $new_title = array();
    /** Archives **************************************************************/
    // Forum Archive
    if (bbp_is_forum_archive()) {
        $new_title['text'] = bbp_get_forum_archive_title();
        // Topic Archive
    } elseif (bbp_is_topic_archive()) {
        $new_title['text'] = bbp_get_topic_archive_title();
        /** Edit ******************************************************************/
        // Forum edit page
    } elseif (bbp_is_forum_edit()) {
        $new_title['text'] = bbp_get_forum_title();
        $new_title['format'] = esc_attr__('Forum Edit: %s', 'bbpress');
        // Topic edit page
    } elseif (bbp_is_topic_edit()) {
        $new_title['text'] = bbp_get_topic_title();
        $new_title['format'] = esc_attr__('Topic Edit: %s', 'bbpress');
        // Reply edit page
    } elseif (bbp_is_reply_edit()) {
        $new_title['text'] = bbp_get_reply_title();
        $new_title['format'] = esc_attr__('Reply Edit: %s', 'bbpress');
        // Topic tag edit page
    } elseif (bbp_is_topic_tag_edit()) {
        $new_title['text'] = bbp_get_topic_tag_name();
        $new_title['format'] = esc_attr__('Topic Tag Edit: %s', 'bbpress');
        /** Singles ***************************************************************/
        // Forum page
    } elseif (bbp_is_single_forum()) {
        $new_title['text'] = bbp_get_forum_title();
        $new_title['format'] = esc_attr__('Forum: %s', 'bbpress');
        // Topic page
    } elseif (bbp_is_single_topic()) {
        $new_title['text'] = bbp_get_topic_title();
        $new_title['format'] = esc_attr__('Topic: %s', 'bbpress');
        // Replies
    } elseif (bbp_is_single_reply()) {
        $new_title['text'] = bbp_get_reply_title();
        // Topic tag page
    } elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag')) {
        $new_title['text'] = bbp_get_topic_tag_name();
        $new_title['format'] = esc_attr__('Topic Tag: %s', 'bbpress');
        /** Users *****************************************************************/
        // Profile page
    } elseif (bbp_is_single_user()) {
        // User is viewing their own profile
        if (bbp_is_user_home()) {
            $new_title['text'] = esc_attr_x('Your', 'User viewing his/her own profile', 'bbpress');
            // User is viewing someone else's profile (so use their display name)
        } else {
            $new_title['text'] = sprintf(esc_attr_x("%s's", 'User viewing another users profile', 'bbpress'), get_userdata(bbp_get_user_id())->display_name);
        }
        // User topics created
        if (bbp_is_single_user_topics()) {
            $new_title['format'] = esc_attr__("%s Topics", 'bbpress');
            // User rueplies created
        } elseif (bbp_is_single_user_replies()) {
            $new_title['format'] = esc_attr__("%s Replies", 'bbpress');
            // User favorites
        } elseif (bbp_is_favorites()) {
            $new_title['format'] = esc_attr__("%s Favorites", 'bbpress');
            // User subscriptions
        } elseif (bbp_is_subscriptions()) {
            $new_title['format'] = esc_attr__("%s Subscriptions", 'bbpress');
            // User "home"
        } else {
            $new_title['format'] = esc_attr__("%s Profile", 'bbpress');
        }
        // Profile edit page
    } elseif (bbp_is_single_user_edit()) {
        // Current user
        if (bbp_is_user_home_edit()) {
            $new_title['text'] = esc_attr__('Edit Your Profile', 'bbpress');
            // Other user
        } else {
            $new_title['text'] = get_userdata(bbp_get_user_id())->display_name;
            $new_title['format'] = esc_attr__("Edit %s's Profile", 'bbpress');
        }
        /** Views *****************************************************************/
        // Views
    } elseif (bbp_is_single_view()) {
        $new_title['text'] = bbp_get_view_title();
        $new_title['format'] = esc_attr__('View: %s', 'bbpress');
        /** Search ****************************************************************/
        // Search
    } elseif (bbp_is_search()) {
        $new_title['text'] = bbp_get_search_title();
    }
    // This filter is deprecated. Use 'bbp_before_title_parse_args' instead.
    $new_title = apply_filters('bbp_raw_title_array', $new_title);
    // Set title array defaults
    $new_title = bbp_parse_args($new_title, array('text' => $title, 'format' => '%s'), 'title');
    // Get the formatted raw title
    $new_title = sprintf($new_title['format'], $new_title['text']);
    // Filter the raw title
    $new_title = apply_filters('bbp_raw_title', $new_title, $sep, $seplocation);
    // Compare new title with original title
    if ($new_title === $title) {
        return $title;
    }
    // Temporary separator, for accurate flipping, if necessary
    $t_sep = '%WP_TITILE_SEP%';
    $prefix = '';
    if (!empty($new_title)) {
        $prefix = " {$sep} ";
    }
    // sep on right, so reverse the order
    if ('right' === $seplocation) {
        $new_title_array = array_reverse(explode($t_sep, $new_title));
        $new_title = implode(" {$sep} ", $new_title_array) . $prefix;
        // sep on left, do not reverse
    } else {
        $new_title_array = explode($t_sep, $new_title);
        $new_title = $prefix . implode(" {$sep} ", $new_title_array);
    }
    // Filter and return
    return apply_filters('bbp_title', $new_title, $sep, $seplocation);
}
Esempio n. 17
0
/**
 * Apply the filtered feedback messages to the forums
 *
 * @since       1.0.0
 * @global      int $user_ID The ID of the current user
 * @return      void
 */
function edd_cr_apply_feedback_messages()
{
    global $user_ID;
    if (bbp_is_single_topic() && !edd_cr_can_view_bbpress()) {
        add_filter('gettext', 'edd_cr_topic_feedback_messages', 20, 3);
    } elseif (bbp_is_single_forum() && !edd_cr_can_view_bbpress()) {
        add_filter('gettext', 'edd_cr_forum_feedback_messages', 20, 3);
    }
}
Esempio n. 18
0
 function mk_theme_breadcrumbs()
 {
     global $mk_options, $post;
     $post_id = global_get_post_id();
     if ($post_id) {
         $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true);
         $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true);
         if ($local_skining == 'true' && !empty($breadcrumb_skin)) {
             $breadcrumb_skin_class = $breadcrumb_skin;
         } else {
             $breadcrumb_skin_class = $mk_options['breadcrumb_skin'];
         }
     } else {
         $breadcrumb_skin_class = $mk_options['breadcrumb_skin'];
     }
     $delimiter = ' &#47; ';
     echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">';
     if (!is_front_page()) {
         echo '<a href="';
         echo home_url();
         echo '">' . __('Home', 'mk_framework');
         echo "</a>" . $delimiter;
     }
     if (function_exists('is_woocommerce') && is_woocommerce() && is_archive()) {
         $shop_page_id = wc_get_page_id('shop');
         $shop_page = get_post($shop_page_id);
         $permalinks = get_option('woocommerce_permalinks');
         if ($shop_page_id && $shop_page && get_option('page_on_front') !== $shop_page_id) {
             echo '<a href="' . get_permalink($shop_page) . '">' . $shop_page->post_title . '</a> ';
         }
     }
     if (is_category() && !is_singular('portfolio')) {
         $category = get_the_category();
         $ID = $category[0]->cat_ID;
         echo is_wp_error($cat_parents = get_category_parents($ID, TRUE, '', FALSE)) ? '' : '<span>' . $cat_parents . '</span>';
     } else {
         if (is_singular('news')) {
             echo '<span>' . get_the_title() . '</span>';
         } else {
             if (is_single() && !is_attachment()) {
                 if (get_post_type() == 'product') {
                     if ($terms = wc_get_product_terms($post->ID, 'product_cat', array('orderby' => 'parent', 'order' => 'DESC'))) {
                         $main_term = $terms[0];
                         $ancestors = get_ancestors($main_term->term_id, 'product_cat');
                         $ancestors = array_reverse($ancestors);
                         foreach ($ancestors as $ancestor) {
                             $ancestor = get_term($ancestor, 'product_cat');
                             if (!is_wp_error($ancestor) && $ancestor) {
                                 echo '<a href="' . get_term_link($ancestor->slug, 'product_cat') . '">' . $ancestor->name . '</a>' . $delimiter;
                             }
                         }
                         echo '<a href="' . get_term_link($main_term->slug, 'product_cat') . '">' . $main_term->name . '</a>' . $delimiter;
                     }
                     echo get_the_title();
                 } elseif (is_singular('portfolio')) {
                     $portfolio_category = get_the_term_list($post->ID, 'portfolio_category', '', ' / ');
                     if (!empty($portfolio_category)) {
                         echo $portfolio_category . $delimiter;
                     }
                     echo '<span>' . get_the_title() . '</span>';
                 } elseif (get_post_type() != 'post') {
                     if (function_exists('is_bbpress') && is_bbpress()) {
                     } else {
                         $post_type = get_post_type_object(get_post_type());
                         $slug = $post_type->rewrite;
                         echo '<a href="' . get_post_type_archive_link(get_post_type()) . '">' . $post_type->labels->singular_name . '</a>' . $delimiter;
                         echo get_the_title();
                     }
                 } else {
                     $cat = current(get_the_category());
                     echo get_category_parents($cat, true, $delimiter);
                     echo get_the_title();
                 }
             } elseif (is_page() && !$post->post_parent) {
                 echo get_the_title();
             } elseif (is_page() && $post->post_parent) {
                 $parent_id = $post->post_parent;
                 $breadcrumbs = array();
                 while ($parent_id) {
                     $page = get_page($parent_id);
                     $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
                     $parent_id = $page->post_parent;
                 }
                 $breadcrumbs = array_reverse($breadcrumbs);
                 foreach ($breadcrumbs as $crumb) {
                     echo $crumb . '' . $delimiter;
                 }
                 echo get_the_title();
             } elseif (is_attachment()) {
                 $parent = get_post($post->post_parent);
                 $cat = get_the_category($parent->ID);
                 $cat = $cat[0];
                 /* admin@innodron.com patch:
                 			   Fix for Catchable fatal error: Object of class WP_Error could not be converted to string
                 			   ref: https://wordpress.org/support/topic/catchable-fatal-error-object-of-class-wp_error-could-not-be-converted-to-string-11
                 			*/
                 echo is_wp_error($cat_parents = get_category_parents($cat, TRUE, '' . $delimiter . '')) ? '' : $cat_parents;
                 /* end admin@innodron.com patch */
                 echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a>' . $delimiter;
                 echo get_the_title();
             } elseif (is_search()) {
                 echo __('Search results for &ldquo;', 'mk_framework') . get_search_query() . '&rdquo;';
             } elseif (is_tag()) {
                 echo __('Tag &ldquo;', 'mk_framework') . single_tag_title('', false) . '&rdquo;';
             } elseif (is_author()) {
                 $userdata = get_userdata(get_the_author_meta('ID'));
                 echo __('Author:', 'mk_framework') . ' ' . $userdata->display_name;
             } elseif (is_day()) {
                 echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter;
                 echo '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a>' . $delimiter;
                 echo get_the_time('d');
             } elseif (is_month()) {
                 echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter;
                 echo get_the_time('F');
             } elseif (is_year()) {
                 echo get_the_time('Y');
             }
         }
     }
     if (get_query_var('paged')) {
         echo ' (' . __('Page', 'mk_framework') . ' ' . get_query_var('paged') . ')';
     }
     if (is_tax()) {
         $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
         if (function_exists('is_woocommerce') && is_woocommerce() && is_archive()) {
             echo $delimiter;
         }
         echo '<span>' . $term->name . '</span>';
     }
     if (function_exists('is_bbpress') && is_bbpress()) {
         $item = array();
         $post_type_object = get_post_type_object(bbp_get_forum_post_type());
         if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
             $item[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>';
         }
         if (bbp_is_forum_archive()) {
             $item[] = bbp_get_forum_archive_title();
         } elseif (bbp_is_topic_archive()) {
             $item[] = bbp_get_topic_archive_title();
         } elseif (bbp_is_single_view()) {
             $item[] = bbp_get_view_title();
         } elseif (bbp_is_single_topic()) {
             $topic_id = get_queried_object_id();
             $item = array_merge($item, mk_breadcrumbs_get_parents(bbp_get_topic_forum_id($topic_id)));
             if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
                 $item[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>';
             } else {
                 $item[] = bbp_get_topic_title($topic_id);
             }
             if (bbp_is_topic_split()) {
                 $item[] = __('Split', 'mk_framework');
             } elseif (bbp_is_topic_merge()) {
                 $item[] = __('Merge', 'mk_framework');
             } elseif (bbp_is_topic_edit()) {
                 $item[] = __('Edit', 'mk_framework');
             }
         } elseif (bbp_is_single_reply()) {
             $reply_id = get_queried_object_id();
             $item = array_merge($item, mk_breadcrumbs_get_parents(bbp_get_reply_topic_id($reply_id)));
             if (!bbp_is_reply_edit()) {
                 $item[] = bbp_get_reply_title($reply_id);
             } else {
                 $item[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>';
                 $item[] = __('Edit', 'mk_framework');
             }
         } elseif (bbp_is_single_forum()) {
             $forum_id = get_queried_object_id();
             $forum_parent_id = bbp_get_forum_parent_id($forum_id);
             if (0 !== $forum_parent_id) {
                 $item = array_merge($item, mk_breadcrumbs_get_parents($forum_parent_id));
             }
             $item[] = bbp_get_forum_title($forum_id);
         } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
             if (bbp_is_single_user_edit()) {
                 $item[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>';
                 $item[] = __('Edit', 'mk_framework');
             } else {
                 $item[] = bbp_get_displayed_user_field('display_name');
             }
         }
         echo implode($delimiter, $item);
     }
     echo "</div></div>";
 }
/**
 * Output an RSS2 feed of replies, based on the query passed.
 *
 * @since bbPress (r3171)
 *
 * @uses bbp_version()
 * @uses bbp_is_single_topic()
 * @uses bbp_user_can_view_forum()
 * @uses bbp_get_topic_forum_id()
 * @uses bbp_show_load_topic()
 * @uses bbp_topic_permalink()
 * @uses bbp_topic_title()
 * @uses bbp_get_topic_reply_count()
 * @uses bbp_topic_content()
 * @uses bbp_has_replies()
 * @uses bbp_replies()
 * @uses bbp_the_reply()
 * @uses bbp_reply_url()
 * @uses bbp_reply_title()
 * @uses bbp_reply_content()
 * @uses get_wp_title_rss()
 * @uses get_option()
 * @uses bloginfo_rss
 * @uses self_link()
 * @uses the_author()
 * @uses get_post_time()
 * @uses rss_enclosure()
 * @uses do_action()
 * @uses apply_filters()
 *
 * @param array $replies_query
 */
function bbp_display_replies_feed_rss2($replies_query = array())
{
    // User cannot access forum this topic is in
    if (bbp_is_single_topic() && !bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) {
        return;
    }
    // Adjust the title based on context
    if (bbp_is_single_topic() && bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) {
        $title = apply_filters('wp_title_rss', get_wp_title_rss(' &#187; '));
    } elseif (!bbp_show_lead_topic()) {
        $title = ' &#187; ' . __('All Posts', 'bbpress');
    } else {
        $title = ' &#187; ' . __('All Replies', 'bbpress');
    }
    // Display the feed
    header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
    header('Status: 200 OK');
    echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
    ?>

	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

		<?php 
    do_action('bbp_feed');
    ?>
	>

	<channel>
		<title><?php 
    bloginfo_rss('name');
    echo $title;
    ?>
</title>
		<atom:link href="<?php 
    self_link();
    ?>
" rel="self" type="application/rss+xml" />
		<link><?php 
    self_link();
    ?>
</link>
		<description><?php 
    //
    ?>
</description>
		<pubDate><?php 
    echo mysql2date('D, d M Y H:i:s O', current_time('mysql'), false);
    ?>
</pubDate>
		<generator>http://bbpress.org/?v=<?php 
    bbp_version();
    ?>
</generator>
		<language><?php 
    bloginfo_rss('language');
    ?>
</language>

		<?php 
    do_action('bbp_feed_head');
    ?>

		<?php 
    if (bbp_is_single_topic()) {
        ?>
			<?php 
        if (bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) {
            ?>
				<?php 
            if (bbp_show_lead_topic()) {
                ?>

					<item>
						<guid><?php 
                bbp_topic_permalink();
                ?>
</guid>
						<title><![CDATA[<?php 
                bbp_topic_title();
                ?>
]]></title>
						<link><?php 
                bbp_topic_permalink();
                ?>
</link>
						<pubDate><?php 
                echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
                ?>
</pubDate>
						<dc:creator><?php 
                the_author();
                ?>
</dc:creator>

						<description>
							<![CDATA[
							<p><?php 
                printf(__('Replies: %s', 'bbpress'), bbp_get_topic_reply_count());
                ?>
</p>
							<?php 
                bbp_topic_content();
                ?>
							]]>
						</description>

						<?php 
                rss_enclosure();
                ?>

						<?php 
                do_action('bbp_feed_item');
                ?>

					</item>

				<?php 
            }
            ?>
			<?php 
        }
        ?>
		<?php 
    }
    ?>

		<?php 
    if (bbp_has_replies($replies_query)) {
        ?>
			<?php 
        while (bbp_replies()) {
            bbp_the_reply();
            ?>

				<item>
					<guid><?php 
            bbp_reply_url();
            ?>
</guid>
					<title><![CDATA[<?php 
            bbp_reply_title();
            ?>
]]></title>
					<link><?php 
            bbp_reply_url();
            ?>
</link>
					<pubDate><?php 
            echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
            ?>
</pubDate>
					<dc:creator><?php 
            the_author();
            ?>
</dc:creator>

					<description>
						<![CDATA[
						<?php 
            bbp_reply_content();
            ?>
						]]>
					</description>

					<?php 
            rss_enclosure();
            ?>

					<?php 
            do_action('bbp_feed_item');
            ?>

				</item>

			<?php 
        }
        ?>
		<?php 
    }
    ?>

		<?php 
    do_action('bbp_feed_footer');
    ?>

	</channel>
	</rss>

<?php 
    // We're done here
    exit;
}
 /**
  * Load localizations for topic script
  *
  * These localizations require information that may not be loaded even by init.
  *
  * @since bbPress (r3732)
  *
  * @uses bbp_is_single_forum() To check if it's the forum page
  * @uses bbp_is_single_topic() To check if it's the topic page
  * @uses is_user_logged_in() To check if user is logged in
  * @uses bbp_get_current_user_id() To get the current user id
  * @uses bbp_get_forum_id() To get the forum id
  * @uses bbp_get_topic_id() To get the topic id
  * @uses bbp_get_favorites_permalink() To get the favorites permalink
  * @uses bbp_is_user_favorite() To check if the topic is in user's favorites
  * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
  * @uses bbp_is_user_subscribed() To check if the user is subscribed to topic
  * @uses bbp_get_topic_permalink() To get the topic permalink
  * @uses wp_localize_script() To localize the script
  */
 public function localize_topic_script()
 {
     // Single forum
     if (bbp_is_single_forum()) {
         wp_localize_script('bbpress-forum', 'bbpForumJS', array('bbp_ajaxurl' => bbp_get_ajax_url(), 'generic_ajax_error' => __('Something went wrong. Refresh your browser and try again.', 'bbpress'), 'is_user_logged_in' => is_user_logged_in(), 'subs_nonce' => wp_create_nonce('toggle-subscription_' . get_the_ID())));
         // Single topic
     } elseif (bbp_is_single_topic()) {
         wp_localize_script('bbpress-topic', 'bbpTopicJS', array('bbp_ajaxurl' => bbp_get_ajax_url(), 'generic_ajax_error' => __('Something went wrong. Refresh your browser and try again.', 'bbpress'), 'is_user_logged_in' => is_user_logged_in(), 'fav_nonce' => wp_create_nonce('toggle-favorite_' . get_the_ID()), 'subs_nonce' => wp_create_nonce('toggle-subscription_' . get_the_ID())));
     }
 }
Esempio n. 21
0
/**
 * Remove the canonical redirect to allow pretty pagination
 *
 * @since bbPress (r2628)
 * @param string $redirect_url Redirect url
 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks
 * @uses bbp_get_paged() To get the current page number
 * @uses bbp_is_single_topic() To check if it's a topic page
 * @uses bbp_is_single_forum() To check if it's a forum page
 * @return bool|string False if it's a topic/forum and their first page,
 *                      otherwise the redirect url
 */
function bbp_redirect_canonical($redirect_url)
{
    global $wp_rewrite;
    // Canonical is for the beautiful
    if ($wp_rewrite->using_permalinks()) {
        // If viewing beyond page 1 of several
        if (1 < bbp_get_paged()) {
            // Only on single topics...
            if (bbp_is_single_topic()) {
                $redirect_url = false;
                // ...and single forums...
            } elseif (bbp_is_single_forum()) {
                $redirect_url = false;
                // ...and single replies...
            } elseif (bbp_is_single_reply()) {
                $redirect_url = false;
                // ...and any single anything else...
                //
                // @todo - Find a more accurate way to disable paged canonicals for
                //          paged shortcode usage within other posts.
            } elseif (is_page() || is_singular()) {
                $redirect_url = false;
            }
            // If editing a topic
        } elseif (bbp_is_topic_edit()) {
            $redirect_url = false;
            // If editing a reply
        } elseif (bbp_is_reply_edit()) {
            $redirect_url = false;
        }
    }
    return $redirect_url;
}
Esempio n. 22
0
/**
 * Return the forum id
 *
 * @since bbPress (r2464)
 *
 * @param $forum_id Optional. Used to check emptiness
 * @uses bbPress::forum_query::in_the_loop To check if we're in the loop
 * @uses bbPress::forum_query::post::ID To get the forum id
 * @uses WP_Query::post::ID To get the forum id
 * @uses bbp_is_single_forum() To check if it's a forum page
 * @uses bbp_is_single_topic() To check if it's a topic page
 * @uses bbp_get_topic_forum_id() To get the topic forum id
 * @uses get_post_field() To get the post's post type
 * @uses apply_filters() Calls 'bbp_get_forum_id' with the forum id and
 *                        supplied forum id
 * @return int The forum id
 */
function bbp_get_forum_id($forum_id = 0)
{
    global $wp_query;
    $bbp = bbpress();
    // Easy empty checking
    if (!empty($forum_id) && is_numeric($forum_id)) {
        $bbp_forum_id = $forum_id;
    } elseif (!empty($bbp->forum_query->in_the_loop) && isset($bbp->forum_query->post->ID)) {
        $bbp_forum_id = $bbp->forum_query->post->ID;
    } elseif (bbp_is_single_forum() && !empty($bbp->current_forum_id)) {
        $bbp_forum_id = $bbp->current_forum_id;
    } elseif (bbp_is_single_forum() && isset($wp_query->post->ID)) {
        $bbp_forum_id = $wp_query->post->ID;
    } elseif (bbp_is_single_topic()) {
        $bbp_forum_id = bbp_get_topic_forum_id();
    } else {
        $bbp_forum_id = 0;
    }
    return (int) apply_filters('bbp_get_forum_id', (int) $bbp_forum_id, $forum_id);
}
Esempio n. 23
0
/**
 * Custom page title for bbPress pages
 *
 * @since bbPress (r2788)
 *
 * @param string $title Optional. The title (not used).
 * @param string $sep Optional, default is '&raquo;'. How to separate the
 *                     various items within the page title.
 * @param string $seplocation Optional. Direction to display title, 'right'.
 * @uses bbp_is_single_user() To check if it's a user profile page
 * @uses bbp_is_single_user_edit() To check if it's a user profile edit page
 * @uses bbp_is_user_home() To check if the profile page is of the current user
 * @uses get_query_var() To get the user id
 * @uses get_userdata() To get the user data
 * @uses bbp_is_single_forum() To check if it's a forum
 * @uses bbp_get_forum_title() To get the forum title
 * @uses bbp_is_single_topic() To check if it's a topic
 * @uses bbp_get_topic_title() To get the topic title
 * @uses bbp_is_single_reply() To check if it's a reply
 * @uses bbp_get_reply_title() To get the reply title
 * @uses is_tax() To check if it's the tag page
 * @uses get_queried_object() To get the queried object
 * @uses bbp_is_single_view() To check if it's a view
 * @uses bbp_get_view_title() To get the view title
 * @uses apply_filters() Calls 'bbp_raw_title' with the title
 * @uses apply_filters() Calls 'bbp_profile_page_wp_title' with the title,
 *                        separator and separator location
 * @return string The tite
 */
function bbp_title($title = '', $sep = '&raquo;', $seplocation = '')
{
    // Store original title to compare
    $_title = $title;
    /** Archives **************************************************************/
    // Forum Archive
    if (bbp_is_forum_archive()) {
        $title = bbp_get_forum_archive_title();
        // Topic Archive
    } elseif (bbp_is_topic_archive()) {
        $title = bbp_get_topic_archive_title();
        /** Singles ***************************************************************/
        // Forum page
    } elseif (bbp_is_single_forum()) {
        $title = sprintf(__('Forum: %s', 'bbpress'), bbp_get_forum_title());
        // Topic page
    } elseif (bbp_is_single_topic()) {
        $title = sprintf(__('Topic: %s', 'bbpress'), bbp_get_topic_title());
        // Replies
    } elseif (bbp_is_single_reply()) {
        $title = bbp_get_reply_title();
        // Topic tag page (or edit)
    } elseif (bbp_is_topic_tag() || bbp_is_topic_tag_edit() || get_query_var('bbp_topic_tag')) {
        $term = get_queried_object();
        $title = sprintf(__('Topic Tag: %s', 'bbpress'), $term->name);
        /** Users *****************************************************************/
        // Profile page
    } elseif (bbp_is_single_user()) {
        // Current users profile
        if (bbp_is_user_home()) {
            $title = __('Your Profile', 'bbpress');
            // Other users profile
        } else {
            $userdata = get_userdata(bbp_get_user_id());
            $title = sprintf(__('%s\'s Profile', 'bbpress'), $userdata->display_name);
        }
        // Profile edit page
    } elseif (bbp_is_single_user_edit()) {
        // Current users profile
        if (bbp_is_user_home_edit()) {
            $title = __('Edit Your Profile', 'bbpress');
            // Other users profile
        } else {
            $userdata = get_userdata(bbp_get_user_id());
            $title = sprintf(__('Edit %s\'s Profile', 'bbpress'), $userdata->display_name);
        }
        /** Views *****************************************************************/
        // Views
    } elseif (bbp_is_single_view()) {
        $title = sprintf(__('View: %s', 'bbpress'), bbp_get_view_title());
    }
    // Filter the raw title
    $title = apply_filters('bbp_raw_title', $title, $sep, $seplocation);
    // Compare new title with original title
    if ($title == $_title) {
        return $title;
    }
    // Temporary separator, for accurate flipping, if necessary
    $t_sep = '%WP_TITILE_SEP%';
    $prefix = '';
    if (!empty($title)) {
        $prefix = " {$sep} ";
    }
    // sep on right, so reverse the order
    if ('right' == $seplocation) {
        $title_array = explode($t_sep, $title);
        $title_array = array_reverse($title_array);
        $title = implode(" {$sep} ", $title_array) . $prefix;
        // sep on left, do not reverse
    } else {
        $title_array = explode($t_sep, $title);
        $title = $prefix . implode(" {$sep} ", $title_array);
    }
    // Filter and return
    return apply_filters('bbp_title', $title, $sep, $seplocation);
}
Esempio n. 24
0
/**
 * The sidebar containing the main widget area.
 *
 * @package Memberlite
 */
do_action('before_sidebar');
?>
<div id="secondary" class="medium-4 columns widget-area" role="complementary">
<?php 
do_action('before_sidebar_widgets');
if (is_singular()) {
    $memberlite_custom_sidebar = get_post_meta($post->ID, '_memberlite_custom_sidebar', true);
    $memberlite_default_sidebar = get_post_meta($post->ID, '_memberlite_default_sidebar', true);
}
if (function_exists('is_bbpress') && (bbp_is_single_topic() || bbp_is_single_forum())) {
    $memberlite_custom_sidebar = get_post_meta(bbp_get_forum_id(), '_memberlite_custom_sidebar', true);
    $memberlite_default_sidebar = get_post_meta(bbp_get_forum_id(), '_memberlite_default_sidebar', true);
}
if (empty($memberlite_default_sidebar) || $memberlite_default_sidebar == 'default_sidebar_above') {
    memberlite_getSidebar();
}
if (!empty($memberlite_custom_sidebar)) {
    //Custom sidebar
    dynamic_sidebar($memberlite_custom_sidebar);
}
if (!empty($memberlite_default_sidebar) && $memberlite_default_sidebar == 'default_sidebar_below') {
    memberlite_getSidebar();
}
do_action('after_sidebar_widgets');
?>
Esempio n. 25
0
/**
 * Return checked value of topic subscription
 *
 * @since 2.0.0 bbPress (r2976)
 *
 * @uses bbp_is_topic_edit() To check if it's the topic edit page
 * @uses bbp_is_user_subscribed_to_topic() To check if the user is
 *                                          subscribed to the topic
 * @uses apply_filters() Calls 'bbp_get_form_topic_subscribed' with the
 *                        option
 * @return string Checked value of topic subscription
 */
function bbp_get_form_topic_subscribed()
{
    // Get _POST data
    if (bbp_is_topic_form_post_request() && isset($_POST['bbp_topic_subscription'])) {
        $topic_subscribed = (bool) $_POST['bbp_topic_subscription'];
        // Get edit data
    } elseif (bbp_is_topic_edit() || bbp_is_reply_edit()) {
        // Get current posts author
        $post_author = bbp_get_global_post_field('post_author', 'raw');
        // Post author is not the current user
        if (bbp_get_current_user_id() !== $post_author) {
            $topic_subscribed = bbp_is_user_subscribed_to_topic($post_author);
            // Post author is the current user
        } else {
            $topic_subscribed = bbp_is_user_subscribed_to_topic(bbp_get_current_user_id());
        }
        // Get current status
    } elseif (bbp_is_single_topic()) {
        $topic_subscribed = bbp_is_user_subscribed_to_topic(bbp_get_current_user_id());
        // No data
    } else {
        $topic_subscribed = false;
    }
    // Get checked output
    $checked = checked($topic_subscribed, true, false);
    return apply_filters('bbp_get_form_topic_subscribed', $checked, $topic_subscribed);
}
Esempio n. 26
0
 function cupid_breadcrumb_get_bbpress_items()
 {
     $item = array();
     $post_type_object = get_post_type_object(bbp_get_forum_post_type());
     if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
         $item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a></li>';
     }
     if (bbp_is_forum_archive()) {
         $item['last'] = bbp_get_forum_archive_title();
     } elseif (bbp_is_topic_archive()) {
         $item['last'] = bbp_get_topic_archive_title();
     } elseif (bbp_is_single_view()) {
         $item['last'] = bbp_get_view_title();
     } elseif (bbp_is_single_topic()) {
         $topic_id = get_queried_object_id();
         $item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_topic_forum_id($topic_id)));
         if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
             $item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a></li>';
         } else {
             $item['last'] = bbp_get_topic_title($topic_id);
         }
         if (bbp_is_topic_split()) {
             $item['last'] = __('Split', 'cupid');
         } elseif (bbp_is_topic_merge()) {
             $item['last'] = __('Merge', 'cupid');
         } elseif (bbp_is_topic_edit()) {
             $item['last'] = __('Edit', 'cupid');
         }
     } elseif (bbp_is_single_reply()) {
         $reply_id = get_queried_object_id();
         $item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_reply_topic_id($reply_id)));
         if (!bbp_is_reply_edit()) {
             $item['last'] = bbp_get_reply_title($reply_id);
         } else {
             $item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a></li>';
             $item['last'] = __('Edit', 'cupid');
         }
     } elseif (bbp_is_single_forum()) {
         $forum_id = get_queried_object_id();
         $forum_parent_id = bbp_get_forum_parent_id($forum_id);
         if (0 !== $forum_parent_id) {
             $item = array_merge($item, cupid_breadcrumb_get_parents($forum_parent_id));
         }
         $item['last'] = bbp_get_forum_title($forum_id);
     } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
         if (bbp_is_single_user_edit()) {
             $item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a></li>';
             $item['last'] = __('Edit', 'cupid');
         } else {
             $item['last'] = bbp_get_displayed_user_field('display_name');
         }
     }
     return apply_filters('cupid_breadcrumb_get_bbpress_items', $item);
 }
Esempio n. 27
0
/**
 * Checks if a post (or any post type) has the given meta key of 'Stylesheet' when on the singular view of 
 * the post on the front of the site.  If found, the function checks within the '/css' folder of the stylesheet 
 * directory (child theme) and the template directory (parent theme).  If the file exists, it is used rather 
 * than the typical style.css file.
 *
 * @since 0.1.0
 * @todo Use features from Ticket #18302 when available. http://core.trac.wordpress.org/ticket/18302
 * @access public
 * @param string $stylesheet_uri The URI of the active theme's stylesheet.
 * @param string $stylesheet_dir_uri The directory URI of the active theme's stylesheet.
 * @return string $stylesheet_uri
 */
function post_stylesheets_stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri)
{
    /* Check if viewing a singular post. */
    if (is_singular()) {
        /* If viewing a bbPress topic, use its forum object. */
        if (function_exists('bbp_is_single_topic') && bbp_is_single_topic()) {
            $post = get_post(bbp_get_topic_forum_id(get_queried_object_id()));
        } elseif (function_exists('bbp_is_single_reply') && bbp_is_single_reply()) {
            $post = get_post(bbp_get_reply_forum_id(get_queried_object_id()));
        } else {
            $post = get_queried_object();
        }
        /* Check if the post type supports 'post-stylesheets' before proceeding. */
        if (post_type_supports($post->post_type, 'post-stylesheets')) {
            /* Check if the user has set a value for the post stylesheet. */
            $stylesheet = get_post_stylesheet($post->ID);
            /* If a meta value was given and the file exists, set $stylesheet_uri to the new file. */
            if (!empty($stylesheet)) {
                /* If the stylesheet is found in the child theme, use it. */
                if (file_exists(trailingslashit(get_stylesheet_directory()) . $stylesheet)) {
                    $stylesheet_uri = trailingslashit($stylesheet_dir_uri) . $stylesheet;
                } elseif (file_exists(trailingslashit(get_template_directory()) . $stylesheet)) {
                    $stylesheet_uri = trailingslashit(get_template_directory_uri()) . $stylesheet;
                } else {
                    /* If the stylesheet is found in the child theme '/css' folder, use it. */
                    if (file_exists(trailingslashit(get_stylesheet_directory()) . "css/{$stylesheet}")) {
                        $stylesheet_uri = trailingslashit($stylesheet_dir_uri) . "css/{$stylesheet}";
                        /* Set the post stylesheet to the correct directory. */
                        set_post_stylesheet($post->ID, str_replace(get_stylesheet_directory_uri(), 'css/', $stylesheet_uri));
                    } elseif (file_exists(trailingslashit(get_template_directory()) . "css/{$stylesheet}")) {
                        $stylesheet_uri = trailingslashit(get_template_directory_uri()) . "css/{$stylesheet}";
                        /* Set the post stylesheet to the correct directory. */
                        set_post_stylesheet($post->ID, str_replace(get_template_directory_uri(), 'css/', $stylesheet_uri));
                    }
                }
            }
        }
    }
    /* Return the stylesheet URI. */
    return $stylesheet_uri;
}
/**
 * Display connected docs
 *
 * @since		1.0.0
 * @return		void
 */
function edd_bbp_display_connected_docs()
{
    if (!current_user_can('moderate')) {
        return;
    }
    $item_id = bbp_get_forum_id();
    // Find connected pages
    $connected = new WP_Query(array('connected_type' => 'forums_to_docs', 'connected_items' => $item_id, 'nopaging' => true, 'post_status' => 'publish'));
    // Display connected pages
    if ($connected->have_posts()) {
        ?>
    <div class="edd_bbp_support_forum_options">
    <?php 
        if (bbp_is_single_topic()) {
            ?>
        <h3>Related Documentation:</h3>
    <?php 
        } else {
            ?>
        <strong>Related Documentation:</strong>
    <?php 
        }
        ?>
        <?php 
        while ($connected->have_posts()) {
            $connected->the_post();
            ?>
            <div><a href="<?php 
            the_permalink();
            ?>
" target="_blank"><?php 
            the_title();
            ?>
</a></div>
        <?php 
        }
        ?>
    </div><br/>
    <?php 
        // Prevent weirdness
        wp_reset_postdata();
    }
}
Esempio n. 29
0
        bbp_breadcrumb();
        ?>
                <div class="pagetitle">
                    <h1><?php 
        the_title();
        ?>
</h1>
                    <?php 
        if (bbp_is_forum_archive()) {
            _e('All Forums directory', 'vibe');
        }
        if (bbp_is_single_forum()) {
            bbp_forum_subscription_link();
            bbp_single_forum_description();
        }
        if (bbp_is_single_topic()) {
            bbp_topic_tag_list();
            bbp_single_topic_description();
        }
        ?>
                    
                </div>
            </div>
            <div class="col-md-3 col-sm-4">
                <?php 
        if (bbp_allow_search()) {
            ?>

                    <div class="bbp-search-form">

                        <?php 
Esempio n. 30
0
 /**
  * Load localizations for topic script.
  *
  * These localizations require information that may not be loaded even by init.
  *
  * @since bbPress (r2652)
  *
  * @uses bbp_is_single_topic() To check if it's the topic page
  * @uses bbp_get_current_user_id() To get the current user id
  * @uses bbp_get_topic_id() To get the topic id
  * @uses bbp_get_favorites_permalink() To get the favorites permalink
  * @uses bbp_is_user_favorite() To check if the topic is in user's favorites
  * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
  * @uses bbp_is_user_subscribed() To check if the user is subscribed to topic
  * @uses bbp_get_topic_permalink() To get the topic permalink
  * @uses wp_localize_script() To localize the script
 */
 function bbp_skeleton_topic_script_localization()
 {
     if (!bbp_is_single_topic()) {
         return;
     }
     $user_id = bbp_get_current_user_id();
     $localizations = array('currentUserId' => $user_id, 'topicId' => bbp_get_topic_id());
     // Favorites
     if (bbp_is_favorites_active()) {
         $localizations['favoritesActive'] = 1;
         $localizations['favoritesLink'] = bbp_get_favorites_permalink($user_id);
         $localizations['isFav'] = (int) bbp_is_user_favorite($user_id);
         $localizations['favLinkYes'] = __('favorites', 'bbpress');
         $localizations['favLinkNo'] = __('?', 'bbpress');
         $localizations['favYes'] = __('This topic is one of your %favLinkYes% [%favDel%]', 'bbpress');
         $localizations['favNo'] = __('%favAdd% (%favLinkNo%)', 'bbpress');
         $localizations['favDel'] = __('&times;', 'bbpress');
         $localizations['favAdd'] = __('Add this topic to your favorites', 'bbpress');
     } else {
         $localizations['favoritesActive'] = 0;
     }
     // Subscriptions
     if (bbp_is_subscriptions_active()) {
         $localizations['subsActive'] = 1;
         $localizations['isSubscribed'] = (int) bbp_is_user_subscribed($user_id);
         $localizations['subsSub'] = __('Subscribe', 'bbpress');
         $localizations['subsUns'] = __('Unsubscribe', 'bbpress');
         $localizations['subsLink'] = bbp_get_topic_permalink();
     } else {
         $localizations['subsActive'] = 0;
     }
     wp_localize_script('bbp_topic', 'bbpTopicJS', $localizations);
 }