Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/01/2013 09:34:55 PM (12 years ago)
Author:
boonebgorges
Message:

Enables theme compat for legacy bbPress 1.x forum content

  • Don't exclude top-level forum directory page from wp_nav_menu() as long as forums are correctly installed
  • Introduces BP_Forums_Legacy_Theme_Compat
  • Tweaks forum directory table styling

Fixes #4854

Props imath

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-templates/bp-legacy/buddypress/forums/index.php

    r6284 r6827  
    1 <?php do_action( 'bp_before_directory_forums' ); ?>
     1<div id="buddypress">
     2   
     3    <?php do_action( 'bp_before_directory_forums' ); ?>
    24
    3 <form action="" method="post" id="forums-search-form" class="dir-form">
     5    <form action="" method="post" id="forums-search-form" class="dir-form">
    46
    5     <?php do_action( 'bp_before_directory_forums_content' ); ?>
     7        <?php do_action( 'bp_before_directory_forums_content' ); ?>
    68
    7     <div id="forums-dir-search" class="dir-search" role="search">
     9        <div id="forums-dir-search" class="dir-search" role="search">
    810
    9         <?php bp_directory_forums_search_form(); ?>
     11            <?php bp_directory_forums_search_form(); ?>
    1012
    11     </div>
    12 </form>
     13        </div>
     14    </form>
    1315
    14 <?php do_action( 'bp_before_topics' ); ?>
     16    <?php do_action( 'bp_before_topics' ); ?>
    1517
    16 <form action="" method="post" id="forums-directory-form" class="dir-form">
     18    <form action="" method="post" id="forums-directory-form" class="dir-form">
    1719
    18     <div class="item-list-tabs" role="navigation">
    19         <ul>
    20             <li class="selected" id="forums-all"><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ); ?>"><?php printf( __( 'All Topics <span>%s</span>', 'buddypress' ), bp_get_forum_topic_count() ); ?></a></li>
     20        <div class="item-list-tabs" role="navigation">
     21            <ul>
     22                <li class="selected" id="forums-all"><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ); ?>"><?php printf( __( 'All Topics <span>%s</span>', 'buddypress' ), bp_get_forum_topic_count() ); ?></a></li>
    2123
    22             <?php if ( is_user_logged_in() && bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) ) : ?>
     24                <?php if ( is_user_logged_in() && bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) ) : ?>
    2325
    24                 <li id="forums-personal"><a href="<?php echo trailingslashit( bp_loggedin_user_domain() . bp_get_forums_slug() . '/topics' ); ?>"><?php printf( __( 'My Topics <span>%s</span>', 'buddypress' ), bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) ); ?></a></li>
     26                    <li id="forums-personal"><a href="<?php echo trailingslashit( bp_loggedin_user_domain() . bp_get_forums_slug() . '/topics' ); ?>"><?php printf( __( 'My Topics <span>%s</span>', 'buddypress' ), bp_get_forum_topic_count_for_user( bp_loggedin_user_id() ) ); ?></a></li>
     27
     28                <?php endif; ?>
     29
     30                <?php do_action( 'bp_forums_directory_group_types' ); ?>
     31
     32            </ul>
     33        </div>
     34
     35        <div class="item-list-tabs" id="subnav" role="navigation">
     36            <ul>
     37
     38                <?php do_action( 'bp_forums_directory_group_sub_types' ); ?>
     39
     40                <li id="forums-order-select" class="last filter">
     41
     42                    <label for="forums-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>
     43                    <select id="forums-order-by">
     44                        <option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option>
     45                        <option value="popular"><?php _e( 'Most Posts', 'buddypress' ); ?></option>
     46                        <option value="unreplied"><?php _e( 'Unreplied', 'buddypress' ); ?></option>
     47
     48                        <?php do_action( 'bp_forums_directory_order_options' ); ?>
     49
     50                    </select>
     51                </li>
     52            </ul>
     53        </div>
     54
     55        <div id="forums-dir-list" class="forums dir-list" role="main">
     56
     57            <?php bp_get_template_part( 'forums/forums-loop' ); ?>
     58
     59        </div>
     60
     61        <?php do_action( 'bp_directory_forums_content' ); ?>
     62
     63        <?php wp_nonce_field( 'directory_forums', '_wpnonce-forums-filter' ); ?>
     64
     65    </form>
     66
     67    <?php do_action( 'bp_after_directory_forums' ); ?>
     68
     69    <?php do_action( 'bp_before_new_topic_form' ); ?>
     70
     71    <div id="new-topic-post">
     72
     73        <?php if ( is_user_logged_in() ) : ?>
     74
     75            <?php if ( bp_is_active( 'groups' ) && bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100' ) ) : ?>
     76
     77                <form action="" method="post" id="forum-topic-form" class="standard-form">
     78
     79                    <?php do_action( 'groups_forum_new_topic_before' ); ?>
     80
     81                    <a name="post-new"></a>
     82                    <h5><?php _e( 'Create New Topic:', 'buddypress' ); ?></h5>
     83
     84                    <?php do_action( 'template_notices' ); ?>
     85
     86                    <label><?php _e( 'Title:', 'buddypress' ); ?></label>
     87                    <input type="text" name="topic_title" id="topic_title" value="" maxlength="100" />
     88
     89                    <label><?php _e( 'Content:', 'buddypress' ); ?></label>
     90                    <textarea name="topic_text" id="topic_text"></textarea>
     91
     92                    <label><?php _e( 'Tags (comma separated):', 'buddypress' ); ?></label>
     93                    <input type="text" name="topic_tags" id="topic_tags" value="" />
     94
     95                    <label><?php _e( 'Post In Group Forum:', 'buddypress' ); ?></label>
     96                    <select id="topic_group_id" name="topic_group_id">
     97
     98                        <option value=""><?php /* translators: no option picked in select box */ _e( '----', 'buddypress' ); ?></option>
     99
     100                        <?php while ( bp_groups() ) : bp_the_group(); ?>
     101
     102                            <?php if ( bp_group_is_forum_enabled() && ( bp_current_user_can( 'bp_moderate' ) || 'public' == bp_get_group_status() || bp_group_is_member() ) ) : ?>
     103
     104                                <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option>
     105
     106                            <?php endif; ?>
     107
     108                        <?php endwhile; ?>
     109
     110                    </select><!-- #topic_group_id -->
     111
     112                    <?php do_action( 'groups_forum_new_topic_after' ); ?>
     113
     114                    <div class="submit">
     115                        <input type="submit" name="submit_topic" id="submit" value="<?php _e( 'Post Topic', 'buddypress' ); ?>" />
     116                        <input type="button" name="submit_topic_cancel" id="submit_topic_cancel" value="<?php _e( 'Cancel', 'buddypress' ); ?>" />
     117                    </div>
     118
     119                    <?php wp_nonce_field( 'bp_forums_new_topic' ); ?>
     120
     121                </form><!-- #forum-topic-form -->
     122
     123            <?php elseif ( bp_is_active( 'groups' ) ) : ?>
     124
     125                <div id="message" class="info">
     126
     127                    <p><?php printf( __( "You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not <a href='%s'>create a new group</a>? Once you have joined or created the group you can post your topic in that group's forum.", 'buddypress' ), site_url( bp_get_groups_root_slug() . '/create/' ) ); ?></p>
     128
     129                </div>
    25130
    26131            <?php endif; ?>
    27132
    28             <?php do_action( 'bp_forums_directory_group_types' ); ?>
     133        <?php endif; ?>
     134    </div><!-- #new-topic-post -->
    29135
    30         </ul>
    31     </div>
     136    <?php do_action( 'bp_after_new_topic_form' ); ?>
    32137
    33     <div class="item-list-tabs" id="subnav" role="navigation">
    34         <ul>
    35 
    36             <?php do_action( 'bp_forums_directory_group_sub_types' ); ?>
    37 
    38             <li id="forums-order-select" class="last filter">
    39 
    40                 <label for="forums-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>
    41                 <select id="forums-order-by">
    42                     <option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option>
    43                     <option value="popular"><?php _e( 'Most Posts', 'buddypress' ); ?></option>
    44                     <option value="unreplied"><?php _e( 'Unreplied', 'buddypress' ); ?></option>
    45 
    46                     <?php do_action( 'bp_forums_directory_order_options' ); ?>
    47 
    48                 </select>
    49             </li>
    50         </ul>
    51     </div>
    52 
    53     <div id="forums-dir-list" class="forums dir-list" role="main">
    54 
    55         <?php bp_get_template_part( 'forums/forums-loop' ); ?>
    56 
    57     </div>
    58 
    59     <?php do_action( 'bp_directory_forums_content' ); ?>
    60 
    61     <?php wp_nonce_field( 'directory_forums', '_wpnonce-forums-filter' ); ?>
    62 
    63 </form>
    64 
    65 <?php do_action( 'bp_after_directory_forums' ); ?>
    66 
    67 <?php do_action( 'bp_before_new_topic_form' ); ?>
    68 
    69 <div id="new-topic-post">
    70 
    71     <?php if ( is_user_logged_in() ) : ?>
    72 
    73         <?php if ( bp_is_active( 'groups' ) && bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100' ) ) : ?>
    74 
    75             <form action="" method="post" id="forum-topic-form" class="standard-form">
    76 
    77                 <?php do_action( 'groups_forum_new_topic_before' ); ?>
    78 
    79                 <a name="post-new"></a>
    80                 <h5><?php _e( 'Create New Topic:', 'buddypress' ); ?></h5>
    81 
    82                 <?php do_action( 'template_notices' ); ?>
    83 
    84                 <label><?php _e( 'Title:', 'buddypress' ); ?></label>
    85                 <input type="text" name="topic_title" id="topic_title" value="" maxlength="100" />
    86 
    87                 <label><?php _e( 'Content:', 'buddypress' ); ?></label>
    88                 <textarea name="topic_text" id="topic_text"></textarea>
    89 
    90                 <label><?php _e( 'Tags (comma separated):', 'buddypress' ); ?></label>
    91                 <input type="text" name="topic_tags" id="topic_tags" value="" />
    92 
    93                 <label><?php _e( 'Post In Group Forum:', 'buddypress' ); ?></label>
    94                 <select id="topic_group_id" name="topic_group_id">
    95 
    96                     <option value=""><?php /* translators: no option picked in select box */ _e( '----', 'buddypress' ); ?></option>
    97 
    98                     <?php while ( bp_groups() ) : bp_the_group(); ?>
    99 
    100                         <?php if ( bp_group_is_forum_enabled() && ( bp_current_user_can( 'bp_moderate' ) || 'public' == bp_get_group_status() || bp_group_is_member() ) ) : ?>
    101 
    102                             <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option>
    103 
    104                         <?php endif; ?>
    105 
    106                     <?php endwhile; ?>
    107 
    108                 </select><!-- #topic_group_id -->
    109 
    110                 <?php do_action( 'groups_forum_new_topic_after' ); ?>
    111 
    112                 <div class="submit">
    113                     <input type="submit" name="submit_topic" id="submit" value="<?php _e( 'Post Topic', 'buddypress' ); ?>" />
    114                     <input type="button" name="submit_topic_cancel" id="submit_topic_cancel" value="<?php _e( 'Cancel', 'buddypress' ); ?>" />
    115                 </div>
    116 
    117                 <?php wp_nonce_field( 'bp_forums_new_topic' ); ?>
    118 
    119             </form><!-- #forum-topic-form -->
    120 
    121         <?php elseif ( bp_is_active( 'groups' ) ) : ?>
    122 
    123             <div id="message" class="info">
    124 
    125                 <p><?php printf( __( "You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not <a href='%s'>create a new group</a>? Once you have joined or created the group you can post your topic in that group's forum.", 'buddypress' ), site_url( bp_get_groups_root_slug() . '/create/' ) ); ?></p>
    126 
    127             </div>
    128 
    129         <?php endif; ?>
    130 
    131     <?php endif; ?>
    132 </div><!-- #new-topic-post -->
    133 
    134 <?php do_action( 'bp_after_new_topic_form' ); ?>
    135 
    136 <?php do_action( 'bp_after_directory_forums_content' ); ?>
     138    <?php do_action( 'bp_after_directory_forums_content' ); ?>
     139   
     140</div>
Note: See TracChangeset for help on using the changeset viewer.