Skip to:
Content

bbPress.org

Changeset 3109


Ignore:
Timestamp:
05/06/2011 10:45:55 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Add improved breadcrumb support to bbp-twentyten, shortcodes, and theme compat. Add improved topic-tag support for theme compat. Add missing topic-tag template tags.

Location:
branches/plugin
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-general-template.php

    r3108 r3109  
    10881088 * @uses bbp_get_breadcrumb() To get the breadcrumb
    10891089 */
    1090 function bbp_title_breadcrumb( $sep = '←' ) {
     1090function bbp_title_breadcrumb( $sep = ' › ' ) {
    10911091        echo bbp_get_breadcrumb( $sep );
    10921092}
    … …  
    11001100 * @uses bbp_get_breadcrumb() To get the breadcrumb
    11011101 */
    1102 function bbp_breadcrumb( $sep = '←', $current_page = true ) {
     1102function bbp_breadcrumb( $sep = ' › ', $current_page = true ) {
    11031103        echo bbp_get_breadcrumb( $sep );
    11041104}
    … …  
    11241124         * @return string Breadcrumbs
    11251125         */
    1126         function bbp_get_breadcrumb( $sep = '←', $current_page = true ) {
     1126        function bbp_get_breadcrumb( $sep = ' › ', $current_page = true ) {
    11271127                global $post, $bbp;
    11281128
    … …  
    11681168                        $breadcrumbs[] = get_the_title();
    11691169
     1170                // Allow the separator of the breadcrumb to be easily changed
     1171                $sep   = apply_filters( 'bbp_breadcrumb_separator', $sep );
     1172
    11701173                // Build the trail
    1171                 if ( !empty( $breadcrumbs ) )
    1172                         $trail = implode( ' ' . $sep . ' ', $breadcrumbs );
    1173                 else
    1174                         $trail = '';
     1174                $trail = !empty( $breadcrumbs ) ? implode( $sep, $breadcrumbs ) : '';
    11751175
    11761176                return apply_filters( 'bbp_get_breadcrumb', $trail );
  • branches/plugin/bbp-includes/bbp-shortcodes.php

    r3095 r3109  
    192192                // Start output buffer
    193193                $this->_ob_start();
     194
     195                // Display breadcrumb if a subforum
     196                if ( bbp_get_forum_parent( $forum_id ) )
     197                        bbp_get_template_part( 'bbpress/nav', 'breadcrumb' );
    194198
    195199                // Check forum caps
    … …  
    356360                // Start output buffer
    357361                $this->_ob_start();
     362
     363                // Breadcrumb
     364                bbp_get_template_part( 'bbpress/nav', 'breadcrumb' );
    358365
    359366                // Check forum caps
  • branches/plugin/bbp-includes/bbp-topic-template.php

    r3101 r3109  
    17191719
    17201720                $defaults = array(
    1721                         'before' => '<p>' . __( 'Tagged:', 'bbpress' ) . '&nbsp;',
     1721                        'before' => '<div class="bbp-topic-tags"><p>' . __( 'Tagged:', 'bbpress' ) . '&nbsp;',
    17221722                        'sep'    => ', ',
    1723                         'after'  => '</p>'
     1723                        'after'  => '</p></div>'
    17241724                );
    17251725
    … …  
    25662566        }
    25672567
     2568/** Topic Tags ****************************************************************/
     2569
     2570/**
     2571 * Output the id of the current tag
     2572 *
     2573 * @since bbPress (r3109)
     2574 *
     2575 * @uses bbp_get_topic_tag_id()
     2576 */
     2577function bbp_topic_tag_id() {
     2578        echo bbp_get_topic_tag_id();
     2579}
     2580        /**
     2581         * Return the id of the current tag
     2582         *
     2583         * @since bbPress (r3109)
     2584         *
     2585         * @uses get_term_by()
     2586         * @uses get_query_var()
     2587         * @uses apply_filters()
     2588         *
     2589         * @return string Term Name
     2590         */
     2591        function bbp_get_topic_tag_id() {
     2592
     2593                // Get the term
     2594                $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
     2595
     2596                // Add before and after if description exists
     2597                if ( !empty( $term->term_id ) )
     2598                        $retval = $term->term_id;
     2599
     2600                // No id
     2601                else
     2602                        $retval = '';
     2603
     2604                return apply_filters( 'bbp_get_topic_tag_id', $retval );
     2605        }
     2606
     2607/**
     2608 * Output the name of the current tag
     2609 *
     2610 * @since bbPress (r3109)
     2611 *
     2612 * @uses bbp_get_topic_tag_name()
     2613 */
     2614function bbp_topic_tag_name() {
     2615        echo bbp_get_topic_tag_name();
     2616}
     2617        /**
     2618         * Return the name of the current tag
     2619         *
     2620         * @since bbPress (r3109)
     2621         *
     2622         * @uses get_term_by()
     2623         * @uses get_query_var()
     2624         * @uses apply_filters()
     2625         *
     2626         * @return string Term Name
     2627         */
     2628        function bbp_get_topic_tag_name() {
     2629
     2630                // Get the term
     2631                $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
     2632
     2633                // Add before and after if description exists
     2634                if ( !empty( $term->name ) )
     2635                        $retval = $term->name;
     2636
     2637                // No name
     2638                else
     2639                        $retval = '';
     2640
     2641                return apply_filters( 'bbp_get_topic_tag_name', $retval );
     2642        }
     2643
     2644/**
     2645 * Output the slug of the current tag
     2646 *
     2647 * @since bbPress (r3109)
     2648 *
     2649 * @uses bbp_get_topic_tag_slug()
     2650 */
     2651function bbp_topic_tag_slug() {
     2652        echo bbp_get_topic_tag_slug();
     2653}
     2654        /**
     2655         * Return the slug of the current tag
     2656         *
     2657         * @since bbPress (r3109)
     2658         *
     2659         * @uses get_term_by()
     2660         * @uses get_query_var()
     2661         * @uses apply_filters()
     2662         *
     2663         * @return string Term Name
     2664         */
     2665        function bbp_get_topic_tag_slug() {
     2666
     2667                // Get the term
     2668                $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
     2669
     2670                // Add before and after if description exists
     2671                if ( !empty( $term->slug ) )
     2672                        $retval = $term->slug;
     2673
     2674                // No slug
     2675                else
     2676                        $retval = '';
     2677
     2678                return apply_filters( 'bbp_get_topic_tag_slug', $retval );
     2679        }
     2680
     2681/**
     2682 * Output the description of the current tag
     2683 *
     2684 * @since bbPress (r3109)
     2685 *
     2686 * @uses bbp_get_topic_tag_description()
     2687 */
     2688function bbp_topic_tag_description( $args = array() ) {
     2689        echo bbp_get_topic_tag_description( $args );
     2690}
     2691        /**
     2692         * Return the description of the current tag
     2693         *
     2694         * @since bbPress (r3109)
     2695         *
     2696         * @uses get_term_by()
     2697         * @uses get_query_var()
     2698         * @uses apply_filters()
     2699         *
     2700         * @return string Term Name
     2701         */
     2702        function bbp_get_topic_tag_description( $args = array() ) {
     2703                global $bbp;
     2704
     2705                $defaults = array(
     2706                        'before' => '<div class="bbp-topic-tag-description"><p>',
     2707                        'after'  => '</p></div>'
     2708                );
     2709                $r = wp_parse_args( $args, $defaults );
     2710                extract( $r );
     2711
     2712                // Get the term
     2713                $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
     2714
     2715                // Add before and after if description exists
     2716                if ( !empty( $term->description ) )
     2717                        $retval = $before . $term->description . $after;
     2718
     2719                // No description, no HTML
     2720                else
     2721                        $retval = '';
     2722
     2723                return apply_filters( 'bbp_get_topic_tag_description', $retval, $args );
     2724        }
     2725
    25682726/** Forms *********************************************************************/
    25692727
  • branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-anonymous.php

    r2943 r3109  
    1010?>
    1111
    12                                         <?php if ( bbp_is_anonymous() || ( bbp_is_topic_edit() && bbp_is_topic_anonymous() ) || ( bbp_is_reply_edit() && bbp_is_reply_anonymous() ) ) : ?>
     12<?php if ( bbp_is_anonymous() || ( bbp_is_topic_edit() && bbp_is_topic_anonymous() ) || ( bbp_is_reply_edit() && bbp_is_reply_anonymous() ) ) : ?>
    1313
    14                                                 <fieldset>
    15                                                         <legend><?php ( bbp_is_topic_edit() || bbp_is_reply_edit() ) ? _e( 'Author information', 'bbpress' ) : _e( 'Your information:', 'bbpress' ); ?></legend>
    16                                                         <p>
    17                                                                 <label for="bbp_anonymous_author"><?php _e( 'Name (required):', 'bbpress' ); ?></label><br />
    18                                                                 <input type="text" id="bbp_anonymous_author" value="<?php bbp_is_topic_edit() ? bbp_topic_author() : bbp_is_reply_edit() ? bbp_reply_author() : bbp_current_anonymous_user_data( 'name' ); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_anonymous_name" />
    19                                                         </p>
     14        <fieldset>
     15                <legend><?php ( bbp_is_topic_edit() || bbp_is_reply_edit() ) ? _e( 'Author information', 'bbpress' ) : _e( 'Your information:', 'bbpress' ); ?></legend>
     16                <p>
     17                        <label for="bbp_anonymous_author"><?php _e( 'Name (required):', 'bbpress' ); ?></label><br />
     18                        <input type="text" id="bbp_anonymous_author" value="<?php bbp_is_topic_edit() ? bbp_topic_author() : bbp_is_reply_edit() ? bbp_reply_author() : bbp_current_anonymous_user_data( 'name' ); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_anonymous_name" />
     19                </p>
    2020
    21                                                         <p>
    22                                                                 <label for="bbp_anonymous_email"><?php _e( 'Mail (will not be published) (required):', 'bbpress' ); ?></label><br />
    23                                                                 <input type="text" id="bbp_anonymous_email" value="<?php echo ( bbp_is_topic_edit() || bbp_is_reply_edit() ) ? get_post_meta( $post->ID, '_bbp_anonymous_email', true ) : bbp_get_current_anonymous_user_data( 'email' ); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_anonymous_email" />
    24                                                         </p>
     21                <p>
     22                        <label for="bbp_anonymous_email"><?php _e( 'Mail (will not be published) (required):', 'bbpress' ); ?></label><br />
     23                        <input type="text" id="bbp_anonymous_email" value="<?php echo ( bbp_is_topic_edit() || bbp_is_reply_edit() ) ? get_post_meta( $post->ID, '_bbp_anonymous_email', true ) : bbp_get_current_anonymous_user_data( 'email' ); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_anonymous_email" />
     24                </p>
    2525
    26                                                         <p>
    27                                                                 <label for="bbp_anonymous_website"><?php _e( 'Website:', 'bbpress' ); ?></label><br />
    28                                                                 <input type="text" id="bbp_anonymous_website" value="<?php bbp_is_topic_edit() ? bbp_topic_author_url() : bbp_is_reply_edit() ? bbp_reply_author_url() : bbp_current_anonymous_user_data( 'website' ); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_anonymous_website" />
    29                                                         </p>
    30                                                 </fieldset>
     26                <p>
     27                        <label for="bbp_anonymous_website"><?php _e( 'Website:', 'bbpress' ); ?></label><br />
     28                        <input type="text" id="bbp_anonymous_website" value="<?php bbp_is_topic_edit() ? bbp_topic_author_url() : bbp_is_reply_edit() ? bbp_reply_author_url() : bbp_current_anonymous_user_data( 'website' ); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_anonymous_website" />
     29                </p>
     30        </fieldset>
    3131
    32                                         <?php endif; ?>
     32<?php endif; ?>
  • branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-topic-tag.php

    r2943 r3109  
    88 */
    99
    10 //@todo - remove $term variable references
    11 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
     10?>
    1211
    13 ?>
    1412<?php if ( current_user_can( 'edit_topic_tags' ) ) : ?>
    1513
    16         <div id="edit-topic-tag-<?php echo $term->term_id; ?>" class="bbp-topic-tag-form">
     14        <div id="edit-topic-tag-<?php bbp_topic_tag_id(); ?>" class="bbp-topic-tag-form">
    1715
    1816                <fieldset>
    1917
    20                         <legend><?php printf( __( 'Manage Tag: "%s"', 'bbpress' ), $term->name ); ?></legend>
     18                        <legend><?php printf( __( 'Manage Tag: "%s"', 'bbpress' ), bbp_get_topic_tag_name() ); ?></legend>
    2119
    2220                        <fieldset id="tag-rename">
    … …  
    3634                                        <div class="alignleft">
    3735                                                <label for="tag-name"><?php _e( 'Name:', 'bbpress' ); ?></label>
    38                                                 <input type="text" name="tag-name" size="20" maxlength="40" tabindex="<?php bbp_tab_index(); ?>" value="<?php echo esc_attr( $term->name ); ?>" />
     36                                                <input type="text" name="tag-name" size="20" maxlength="40" tabindex="<?php bbp_tab_index(); ?>" value="<?php echo esc_attr( bbp_get_topic_tag_slug() ); ?>" />
    3937                                        </div>
    4038
    4139                                        <div class="alignleft">
    4240                                                <label for="tag-name"><?php _e( 'Slug:', 'bbpress' ); ?></label>
    43                                                 <input type="text" name="tag-slug" size="20" maxlength="40" tabindex="<?php bbp_tab_index(); ?>" value="<?php echo esc_attr( apply_filters( 'editable_slug', $term->slug ) ); ?>" />
     41                                                <input type="text" name="tag-slug" size="20" maxlength="40" tabindex="<?php bbp_tab_index(); ?>" value="<?php echo esc_attr( apply_filters( 'editable_slug', bbp_get_topic_tag_slug() ) ); ?>" />
    4442                                        </div>
    4543
    … …  
    4745                                                <input type="submit" name="submit" tabindex="<?php bbp_tab_index(); ?>" value="<?php esc_attr_e( 'Update', 'bbpress' ); ?>" /><br />
    4846
    49                                                 <input type="hidden" name="tag-id" value="<?php echo esc_attr( $term->term_id ); ?>" />
     47                                                <input type="hidden" name="tag-id" value="<?php bbp_get_topic_tag_id(); ?>" />
    5048                                                <input type="hidden" name="action" value="bbp-update-topic-tag" />
    5149
    52                                                 <?php wp_nonce_field( 'update-tag_' . $term->term_id ); ?>
     50                                                <?php wp_nonce_field( 'update-tag_' . bbp_get_topic_tag_id() ); ?>
    5351
    5452                                        </div>
    … …  
    7472                                        <div class="alignright">
    7573                                                <input type="submit" name="submit" tabindex="<?php bbp_tab_index(); ?>" value="<?php esc_attr_e( 'Merge', 'bbpress' ); ?>"
    76                                                         onclick="return confirm('<?php echo esc_js( sprintf( __( 'Are you sure you want to merge the "%s" tag into the tag you specified?', 'bbpress' ), $term->name ) ); ?>');" />
     74                                                        onclick="return confirm('<?php echo esc_js( sprintf( __( 'Are you sure you want to merge the "%s" tag into the tag you specified?', 'bbpress' ), bbp_get_topic_tag_name() ) ); ?>');" />
    7775
    78                                                 <input type="hidden" name="tag-id" value="<?php echo $term->term_id; ?>" />
     76                                                <input type="hidden" name="tag-id" value="<?php bbp_topic_tag_id(); ?>" />
    7977                                                <input type="hidden" name="action" value="bbp-merge-topic-tag" />
    8078
    81                                                 <?php wp_nonce_field( 'merge-tag_' . $term->term_id ); ?>
     79                                                <?php wp_nonce_field( 'merge-tag_' . bbp_get_topic_tag_id() ); ?>
    8280                                        </div>
    8381                                </form>
    … …  
    9694                                        <div class="bbp-template-notice">
    9795                                                <p><?php _e( 'Deleting a tag cannot be undone.', 'bbpress' ); ?></p>
    98                                                 <p><?php _e( 'Any links to this tag will no longer function.', 'bbpress' ); ?></p>                                             
     96                                                <p><?php _e( 'Any links to this tag will no longer function.', 'bbpress' ); ?></p>
    9997                                        </div>
    10098
    … …  
    103101                                                <div class="alignright">
    104102                                                        <input type="submit" name="submit" tabindex="<?php bbp_tab_index(); ?>" value="<?php _e( 'Delete', 'bbpress' ); ?>"
    105                                                                 onclick="return confirm('<?php echo esc_js( sprintf( __( 'Are you sure you want to delete the "%s" tag? This is permanent and cannot be undone.', 'bbpress' ), $term->name ) ); ?>');" />
     103                                                                onclick="return confirm('<?php echo esc_js( sprintf( __( 'Are you sure you want to delete the "%s" tag? This is permanent and cannot be undone.', 'bbpress' ), bbp_get_topic_tag_name() ) ); ?>');" />
    106104
    107                                                         <input type="hidden" name="tag-id" value="<?php echo $term->term_id; ?>" />
     105                                                        <input type="hidden" name="tag-id" value="<?php bbp_topic_tag_id(); ?>" />
    108106                                                        <input type="hidden" name="action" value="bbp-delete-topic-tag" />
    109107
    110                                                         <?php wp_nonce_field( 'delete-tag_' . $term->term_id ); ?>
     108                                                        <?php wp_nonce_field( 'delete-tag_' . bbp_get_topic_tag_id() ); ?>
    111109                                                </div>
    112110                                        </form>
  • branches/plugin/bbp-themes/bbp-twentyten/css/bbpress.css

    r3103 r3109  
    3030#main table.bbp-replies {
    3131        clear: left;
     32}
     33
     34/* =Breadcrumb and Tags
     35-------------------------------------------------------------- */
     36
     37div.bbp-breadcrumb {
     38        float: left;
     39}
     40
     41div.bbp-breadcrumb,
     42div.bbp-topic-tags {
     43        font-size: 12px;
     44}
     45
     46#content div.bbp-breadcrumb p,
     47#content div.bbp-topic-tags p {
     48        margin-bottom: 10px
     49}
     50
     51div.bbp-topic-tags {
     52        float: right;
    3253}
    3354
  • branches/plugin/bbp-themes/bbp-twentyten/single-forum.php

    r3057 r3109  
    2222
    2323                                                <div id="forum-<?php bbp_forum_id(); ?>" class="bbp-forum-info">
    24                                                         <h1 class="entry-title"><?php bbp_title_breadcrumb(); ?></h1>
     24                                                        <h1 class="entry-title"><?php bbp_forum_title(); ?></h1>
    2525                                                        <div class="entry-content">
     26
     27                                                                <?php if ( bbp_get_forum_parent() ) bbp_get_template_part( 'bbpress/nav', 'breadcrumb' ); ?>
    2628
    2729                                                                <?php the_content(); ?>
  • branches/plugin/bbp-themes/bbp-twentyten/single-reply.php

    r2943 r3109  
    2020
    2121                                        <div id="bbp-reply-wrapper-<?php bbp_reply_id(); ?>" class="bbp-reply-wrapper">
    22                                                 <h1 class="entry-title"><?php bbp_title_breadcrumb(); ?></h1>
     22                                                <h1 class="entry-title"><?php bbp_reply_title(); ?></h1>
     23
     24                                                <?php bbp_get_template_part( 'bbpress/nav', 'breadcrumb' ); ?>
     25
    2326                                                <div class="entry-content">
    2427
  • branches/plugin/bbp-themes/bbp-twentyten/single-topic.php

    r3057 r3109  
    2222
    2323                                                <div id="bbp-topic-wrapper-<?php bbp_topic_id(); ?>" class="bbp-topic-wrapper">
    24                                                         <h1 class="entry-title"><?php bbp_title_breadcrumb(); ?></h1>
     24                                                        <h1 class="entry-title"><?php bbp_topic_title(); ?></h1>
    2525                                                        <div class="entry-content">
     26
     27                                                                <?php bbp_get_template_part( 'bbpress/nav', 'breadcrumb' ); ?>
    2628
    2729                                                                <?php bbp_topic_tag_list(); ?>
  • branches/plugin/bbp-themes/bbp-twentyten/taxonomy-topic-tag.php

    r3057 r3109  
    77 * @subpackage Theme
    88 */
    9 
    10 //@todo - remove $term variable references
    11 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
    129
    1310?>
    … …  
    2118
    2219                                <div id="topic-tag" class="bbp-topic-tag">
    23                                         <h1 class="entry-title"><?php printf( __( 'Topic Tag: %s', 'bbpress' ), '<span>' . $term->name . '</span>' ); ?></h1>
     20                                        <h1 class="entry-title"><?php printf( __( 'Topic Tag: %s', 'bbpress' ), '<span>' . bbp_get_topic_tag_name() . '</span>' ); ?></h1>
    2421
    2522                                        <div class="entry-content">
    2623
    27                                                 <?php term_description(); ?>
     24                                                <?php bbp_topic_tag_description(); ?>
    2825
    29                                                 <?php bbp_get_template_part( 'bbpress/pagination', 'topics'    ); ?>
     26                                                <?php if ( bbp_has_topics() ) : ?>
    3027
    31                                                 <?php bbp_get_template_part( 'bbpress/loop',      'topics'    ); ?>
     28                                                        <?php bbp_get_template_part( 'bbpress/pagination', 'topics'    ); ?>
    3229
    33                                                 <?php bbp_get_template_part( 'bbpress/pagination', 'topics'    ); ?>
     30                                                        <?php bbp_get_template_part( 'bbpress/loop',      'topics'    ); ?>
    3431
    35                                                 <?php bbp_get_template_part( 'bbpress/form',       'topic-tag' ); ?>
     32                                                        <?php bbp_get_template_part( 'bbpress/pagination', 'topics'    ); ?>
     33
     34                                                        <?php bbp_get_template_part( 'bbpress/form',       'topic-tag' ); ?>
     35
     36                                                <?php else : ?>
     37
     38                                                        <?php bbp_get_template_part( 'bbpress/no', 'topics' ); ?>
     39
     40                                                <?php endif; ?>
    3641
    3742                                        </div>
Note: See TracChangeset for help on using the changeset viewer.