Ticket #4854: 4854.diff
File 4854.diff, 13.9 KB (added by , 12 years ago) |
---|
-
bp-core/bp-core-filters.php
91 91 if ( !empty( $bp->pages->register ) ) 92 92 $pages[] = $bp->pages->register->id; 93 93 94 if ( !empty( $bp->pages->forums ) )94 if ( !empty( $bp->pages->forums ) && ( !bp_is_active( 'forums' ) || ( bp_is_active( 'forums' ) && bp_forums_has_directory() && !bp_forums_is_installed_correctly() ) ) ) 95 95 $pages[] = $bp->pages->forums->id; 96 96 97 97 return apply_filters( 'bp_core_exclude_pages', $pages ); -
bp-templates/bp-legacy/buddypress/forums/index.php
1 <?php do_action( 'bp_before_directory_forums' ); ?> 1 <div id="buddypress"> 2 3 <?php do_action( 'bp_before_directory_forums' ); ?> 2 4 3 <form action="" method="post" id="forums-search-form" class="dir-form">5 <form action="" method="post" id="forums-search-form" class="dir-form"> 4 6 5 <?php do_action( 'bp_before_directory_forums_content' ); ?>7 <?php do_action( 'bp_before_directory_forums_content' ); ?> 6 8 7 <div id="forums-dir-search" class="dir-search" role="search">9 <div id="forums-dir-search" class="dir-search" role="search"> 8 10 9 <?php bp_directory_forums_search_form(); ?>11 <?php bp_directory_forums_search_form(); ?> 10 12 11 </div>12 </form>13 </div> 14 </form> 13 15 14 <?php do_action( 'bp_before_topics' ); ?>16 <?php do_action( 'bp_before_topics' ); ?> 15 17 16 <form action="" method="post" id="forums-directory-form" class="dir-form">18 <form action="" method="post" id="forums-directory-form" class="dir-form"> 17 19 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> 21 23 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() ) ) : ?> 23 25 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> 25 27 26 <?php endif; ?>28 <?php endif; ?> 27 29 28 <?php do_action( 'bp_forums_directory_group_types' ); ?>30 <?php do_action( 'bp_forums_directory_group_types' ); ?> 29 31 30 </ul>31 </div>32 </ul> 33 </div> 32 34 33 <div class="item-list-tabs" id="subnav" role="navigation">34 <ul>35 <div class="item-list-tabs" id="subnav" role="navigation"> 36 <ul> 35 37 36 <?php do_action( 'bp_forums_directory_group_sub_types' ); ?>38 <?php do_action( 'bp_forums_directory_group_sub_types' ); ?> 37 39 38 <li id="forums-order-select" class="last filter">40 <li id="forums-order-select" class="last filter"> 39 41 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>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> 45 47 46 <?php do_action( 'bp_forums_directory_order_options' ); ?>48 <?php do_action( 'bp_forums_directory_order_options' ); ?> 47 49 48 </select>49 </li>50 </ul>51 </div>50 </select> 51 </li> 52 </ul> 53 </div> 52 54 53 <div id="forums-dir-list" class="forums dir-list" role="main">55 <div id="forums-dir-list" class="forums dir-list" role="main"> 54 56 55 <?php bp_get_template_part( 'forums/forums-loop' ); ?>57 <?php bp_get_template_part( 'forums/forums-loop' ); ?> 56 58 57 </div>59 </div> 58 60 59 <?php do_action( 'bp_directory_forums_content' ); ?>61 <?php do_action( 'bp_directory_forums_content' ); ?> 60 62 61 <?php wp_nonce_field( 'directory_forums', '_wpnonce-forums-filter' ); ?>63 <?php wp_nonce_field( 'directory_forums', '_wpnonce-forums-filter' ); ?> 62 64 63 </form>65 </form> 64 66 65 <?php do_action( 'bp_after_directory_forums' ); ?>67 <?php do_action( 'bp_after_directory_forums' ); ?> 66 68 67 <?php do_action( 'bp_before_new_topic_form' ); ?>69 <?php do_action( 'bp_before_new_topic_form' ); ?> 68 70 69 <div id="new-topic-post">71 <div id="new-topic-post"> 70 72 71 <?php if ( is_user_logged_in() ) : ?>73 <?php if ( is_user_logged_in() ) : ?> 72 74 73 <?php if ( bp_is_active( 'groups' ) && bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100' ) ) : ?>75 <?php if ( bp_is_active( 'groups' ) && bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100' ) ) : ?> 74 76 75 <form action="" method="post" id="forum-topic-form" class="standard-form">77 <form action="" method="post" id="forum-topic-form" class="standard-form"> 76 78 77 <?php do_action( 'groups_forum_new_topic_before' ); ?>79 <?php do_action( 'groups_forum_new_topic_before' ); ?> 78 80 79 <a name="post-new"></a>80 <h5><?php _e( 'Create New Topic:', 'buddypress' ); ?></h5>81 <a name="post-new"></a> 82 <h5><?php _e( 'Create New Topic:', 'buddypress' ); ?></h5> 81 83 82 <?php do_action( 'template_notices' ); ?>84 <?php do_action( 'template_notices' ); ?> 83 85 84 <label><?php _e( 'Title:', 'buddypress' ); ?></label>85 <input type="text" name="topic_title" id="topic_title" value="" maxlength="100" />86 <label><?php _e( 'Title:', 'buddypress' ); ?></label> 87 <input type="text" name="topic_title" id="topic_title" value="" maxlength="100" /> 86 88 87 <label><?php _e( 'Content:', 'buddypress' ); ?></label>88 <textarea name="topic_text" id="topic_text"></textarea>89 <label><?php _e( 'Content:', 'buddypress' ); ?></label> 90 <textarea name="topic_text" id="topic_text"></textarea> 89 91 90 <label><?php _e( 'Tags (comma separated):', 'buddypress' ); ?></label>91 <input type="text" name="topic_tags" id="topic_tags" value="" />92 <label><?php _e( 'Tags (comma separated):', 'buddypress' ); ?></label> 93 <input type="text" name="topic_tags" id="topic_tags" value="" /> 92 94 93 <label><?php _e( 'Post In Group Forum:', 'buddypress' ); ?></label>94 <select id="topic_group_id" name="topic_group_id">95 <label><?php _e( 'Post In Group Forum:', 'buddypress' ); ?></label> 96 <select id="topic_group_id" name="topic_group_id"> 95 97 96 <option value=""><?php /* translators: no option picked in select box */ _e( '----', 'buddypress' ); ?></option>98 <option value=""><?php /* translators: no option picked in select box */ _e( '----', 'buddypress' ); ?></option> 97 99 98 <?php while ( bp_groups() ) : bp_the_group(); ?>100 <?php while ( bp_groups() ) : bp_the_group(); ?> 99 101 100 <?php if ( bp_group_is_forum_enabled() && ( bp_current_user_can( 'bp_moderate' ) || 'public' == bp_get_group_status() || bp_group_is_member() ) ) : ?>102 <?php if ( bp_group_is_forum_enabled() && ( bp_current_user_can( 'bp_moderate' ) || 'public' == bp_get_group_status() || bp_group_is_member() ) ) : ?> 101 103 102 <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option>104 <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option> 103 105 104 <?php endif; ?>106 <?php endif; ?> 105 107 106 <?php endwhile; ?>108 <?php endwhile; ?> 107 109 108 </select><!-- #topic_group_id -->110 </select><!-- #topic_group_id --> 109 111 110 <?php do_action( 'groups_forum_new_topic_after' ); ?>112 <?php do_action( 'groups_forum_new_topic_after' ); ?> 111 113 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>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> 116 118 117 <?php wp_nonce_field( 'bp_forums_new_topic' ); ?>119 <?php wp_nonce_field( 'bp_forums_new_topic' ); ?> 118 120 119 </form><!-- #forum-topic-form -->121 </form><!-- #forum-topic-form --> 120 122 121 <?php elseif ( bp_is_active( 'groups' ) ) : ?>123 <?php elseif ( bp_is_active( 'groups' ) ) : ?> 122 124 123 <div id="message" class="info">125 <div id="message" class="info"> 124 126 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>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> 126 128 127 </div>129 </div> 128 130 131 <?php endif; ?> 132 129 133 <?php endif; ?> 134 </div><!-- #new-topic-post --> 130 135 131 <?php endif; ?> 132 </div><!-- #new-topic-post --> 136 <?php do_action( 'bp_after_new_topic_form' ); ?> 133 137 134 <?php do_action( 'bp_after_new_topic_form' ); ?>135 136 < ?php do_action( 'bp_after_directory_forums_content' ); ?>137 No newline at end of file 138 <?php do_action( 'bp_after_directory_forums_content' ); ?> 139 140 </div> 141 No newline at end of file -
bp-forums/bp-forums-screens.php
118 118 bp_core_load_template( apply_filters( 'bp_forums_screen_single_topic', 'forums/single/topic' ) ); 119 119 } 120 120 add_action( 'bp_screens', 'bp_forums_screen_single_topic' ); 121 122 123 /** Theme Compatability *******************************************************/ 124 125 /** 126 * The main theme compat class for BuddyPress "old" forums 127 * 128 * This class sets up the necessary theme compatability actions to safely output 129 * old forum template parts to the_title and the_content areas of a theme. 130 * 131 * @since BuddyPress (1.7) 132 */ 133 class BP_bbForum_Theme_Compat { 134 135 /** 136 * Setup the old forums component theme compatibility 137 * 138 * @since BuddyPress (1.7) 139 */ 140 public function __construct() { 141 add_action( 'bp_setup_theme_compat', array( $this, 'is_bb_forum' ) ); 142 } 143 144 /** 145 * Are we looking at something that needs old forum theme compatability? 146 * 147 * @since BuddyPress (1.7) 148 */ 149 public function is_bb_forum() { 150 151 // Bail if not looking at a group 152 if ( ! bp_is_forums_component() ) 153 return; 154 155 // forum Directory 156 if ( ( !bp_current_action() || ( 'tag' == bp_current_action() && bp_action_variables() ) ) && !bp_current_item() ) { 157 158 if ( !bp_forums_has_directory() ) 159 return false; 160 161 if ( !bp_forums_is_installed_correctly() ) { 162 bp_core_add_message( __( 'The forums component has not been set up yet.', 'buddypress' ), 'error' ); 163 bp_core_redirect( bp_get_root_domain() ); 164 } 165 166 bp_update_is_directory( true, 'forums' ); 167 168 do_action( 'bp_forums_directory_forums_setup' ); 169 170 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) ); 171 add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) ); 172 173 } 174 175 } 176 177 /** Directory *************************************************************/ 178 179 /** 180 * Update the global $post with directory data 181 * 182 * @since BuddyPress (1.7) 183 */ 184 public function directory_dummy_post() { 185 186 // Title based on ability to create groups 187 if ( is_user_logged_in() ) { 188 $title = __( 'Forums Directory', 'buddypress' ) . ' <a class="button show-hide-new bp-title-button" href="#new-topic" id="new-topic-button">' . __( 'New Topic', 'buddypress' ) . '</a>'; 189 } else { 190 $title = __( 'Forums Directory', 'buddypress' ); 191 } 192 193 bp_theme_compat_reset_post( array( 194 'ID' => 0, 195 'post_title' => $title, 196 'post_author' => 0, 197 'post_date' => 0, 198 'post_content' => '', 199 'post_type' => 'bp_forum', 200 'post_status' => 'publish', 201 'is_archive' => true, 202 'comment_status' => 'closed' 203 ) ); 204 } 205 206 /** 207 * Filter the_content with the old forum index template part 208 * 209 * @since BuddyPress (1.7) 210 */ 211 public function directory_content() { 212 bp_buffer_template_part( 'forums/index' ); 213 } 214 } 215 new BP_bbForum_Theme_Compat(); 216 No newline at end of file