Ticket #7526: 7526.2.patch
File 7526.2.patch, 10.8 KB (added by , 5 years ago) |
---|
-
src/bp-activity/classes/class-bp-activity-list-table.php
diff --git src/bp-activity/classes/class-bp-activity-list-table.php src/bp-activity/classes/class-bp-activity-list-table.php index 1538d2140..a10548d4b 100644
class BP_Activity_List_Table extends WP_List_Table { 38 38 */ 39 39 public $spam_count = 0; 40 40 41 /** 42 * Total number of activities. 43 * 44 * @since 6.0.0 45 * @var int $all_count 46 */ 47 public $all_count = 0; 48 41 49 /** 42 50 * Store activity-to-user-ID mappings for use in the In Response To column. 43 51 * … … class BP_Activity_List_Table extends WP_List_Table { 97 105 $per_page = $this->get_items_per_page( str_replace( '-', '_', "{$this->screen->id}_per_page" ) ); 98 106 99 107 // Check if we're on the "Spam" view. 100 if ( ! empty( $_REQUEST['activity_status'] ) && 'spam'== $_REQUEST['activity_status'] ) {108 if ( ! empty( $_REQUEST['activity_status'] ) && 'spam' === $_REQUEST['activity_status'] ) { 101 109 $spam = 'spam_only'; 102 110 $this->view = 'spam'; 103 111 } 104 112 105 // Sort order.106 if ( !empty( $_REQUEST['order'] ) && 'desc' != $_REQUEST['order'] )107 $sort = 'ASC';108 109 // Order by.110 /*if ( !empty( $_REQUEST['orderby'] ) ) {111 }*/112 113 113 // Filter. 114 114 if ( ! empty( $_REQUEST['activity_type'] ) ) { 115 115 $filter = array( 'action' => $_REQUEST['activity_type'] ); 116 116 117 // Set the view as a filtered one. 118 $this->view = 'filtered'; 119 117 120 /** 118 121 * Filter here to override the filter with a filter query 119 122 * … … class BP_Activity_List_Table extends WP_List_Table { 133 136 } 134 137 135 138 // Are we doing a search? 136 if ( ! empty( $_REQUEST['s'] ) )139 if ( ! empty( $_REQUEST['s'] ) ) { 137 140 $search_terms = $_REQUEST['s']; 138 141 142 // Set the view as a search request. 143 $this->view = 'search'; 144 } 145 139 146 // Check if user has clicked on a specific activity (if so, fetch only that, and any related, activity). 140 if ( ! empty( $_REQUEST['aid'] ) )147 if ( ! empty( $_REQUEST['aid'] ) ) { 141 148 $include_id = (int) $_REQUEST['aid']; 142 149 150 // Set the view as a single activity. 151 $this->view = 'single'; 152 } 153 143 154 // Get the spam total (ignoring any search query or filter). 144 155 $spams = bp_activity_get( array( 145 156 'display_comments' => 'stream', … … class BP_Activity_List_Table extends WP_List_Table { 160 171 'search_terms' => $search_terms, 161 172 'filter_query' => $filter_query, 162 173 'show_hidden' => true, 163 // 'sort' => $sort,164 174 'spam' => $spam, 165 175 'count_total' => 'count_query', 166 176 ) ); … … class BP_Activity_List_Table extends WP_List_Table { 184 194 } 185 195 186 196 // Set raw data to display. 187 $this->items 197 $this->items = $new_activities; 188 198 189 199 // Store information needed for handling table pagination. 190 200 $this->set_pagination_args( array( … … class BP_Activity_List_Table extends WP_List_Table { 195 205 196 206 // Don't truncate activity items; bp_activity_truncate_entry() needs to be used inside a BP_Activity_Template loop. 197 207 remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 ); 208 209 // Set the Total number of activities. 210 if ( 'all' === $this->view ) { 211 $this->all_count = (int) $activities['total']; 212 213 // Only perform a query if not on the main list view. 214 } elseif ( 'single' !== $this->view ) { 215 $count_activities = bp_activity_get( 216 array( 217 'fields' => 'ids', 218 'show_hidden' => true, 219 'count_total' => 'count_query', 220 ) 221 ); 222 223 if ( $count_activities['total'] ) { 224 $this->all_count = (int) $count_activities['total']; 225 } 226 } 198 227 } 199 228 200 229 /** … … class BP_Activity_List_Table extends WP_List_Table { 309 338 310 339 <h2 class="screen-reader-text"><?php 311 340 /* translators: accessibility text */ 312 _e( 'Filter activities list', 'buddypress' );341 esc_html_e( 'Filter activities list', 'buddypress' ); 313 342 ?></h2> 314 343 315 344 <ul class="subsubsub"> 316 <li class="all"><a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li> 317 <li class="spam"><a href="<?php echo esc_url( add_query_arg( array( 'activity_status' => 'spam' ), $url_base ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li> 345 <li class="all"> 346 <a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'all' === $this->view ) echo 'current'; ?>"> 347 <?php printf( 348 /* translators: %s is the placeholder for the count html tag `<span class="count"/>` */ 349 esc_html__( 'All %s', 'buddypress' ), 350 sprintf( 351 '<span class="count">(%s)</span>', 352 number_format_i18n( $this->all_count ) 353 ) 354 ); ?> 355 </a> | 356 </li> 357 <li class="spam"> 358 <a href="<?php echo esc_url( add_query_arg( array( 'activity_status' => 'spam' ), $url_base ) ); ?>" class="<?php if ( 'spam' === $this->view ) echo 'current'; ?>"> 359 <?php printf( 360 /* translators: %s is the placeholder for the count html tag `<span class="count"/>` */ 361 esc_html__( 'Spam %s', 'buddypress' ), 362 sprintf( 363 '<span class="count">(%s)</span>', 364 number_format_i18n( $this->spam_count ) 365 ) 366 ); ?> 367 </a> 368 </li> 318 369 319 370 <?php 320 371 -
src/bp-groups/classes/class-bp-groups-list-table.php
diff --git src/bp-groups/classes/class-bp-groups-list-table.php src/bp-groups/classes/class-bp-groups-list-table.php index 039d913ad..e5b97eb79 100644
class BP_Groups_List_Table extends WP_List_Table { 95 95 96 96 // Sort order. 97 97 $order = 'DESC'; 98 if ( ! empty( $_REQUEST['order'] ) ) {98 if ( ! empty( $_REQUEST['order'] ) ) { 99 99 $order = ( 'desc' == strtolower( $_REQUEST['order'] ) ) ? 'DESC' : 'ASC'; 100 100 } 101 101 … … class BP_Groups_List_Table extends WP_List_Table { 119 119 } 120 120 121 121 // Are we doing a search? 122 if ( ! empty( $_REQUEST['s'] ) )122 if ( ! empty( $_REQUEST['s'] ) ) { 123 123 $search_terms = $_REQUEST['s']; 124 124 125 // Set the view as a search request. 126 $this->view = 'search'; 127 } 128 125 129 // Check if user has clicked on a specific group (if so, fetch only that group). 126 if ( ! empty( $_REQUEST['gid'] ) )130 if ( ! empty( $_REQUEST['gid'] ) ) { 127 131 $include_id = (int) $_REQUEST['gid']; 128 132 129 // Set the current view. 133 // Set the view as a single activity. 134 $this->view = 'single'; 135 } 136 137 // Use the status request to set the current view. 130 138 if ( isset( $_GET['group_status'] ) && in_array( $_GET['group_status'], array( 'public', 'private', 'hidden' ) ) ) { 131 139 $this->view = $_GET['group_status']; 132 140 } … … class BP_Groups_List_Table extends WP_List_Table { 186 194 'total_items' => $groups_template->total_group_count, 187 195 'total_pages' => ceil( $groups_template->total_group_count / $per_page ) 188 196 ) ); 197 198 // Set the Total number of groups. 199 if ( 'all' === $this->view ) { 200 $this->group_counts['all'] = (int) $groups_template->total_group_count; 201 202 // Only perform a query if not on the main list view. 203 } elseif ( 'single' !== $this->view ) { 204 $count_groups = groups_get_groups( 205 array( 206 'fields' => 'ids', 207 'show_hidden' => true, 208 ) 209 ); 210 211 if ( $count_groups['total'] ) { 212 $this->group_counts['all'] = (int) $count_groups['total']; 213 } 214 } 189 215 } 190 216 191 217 /** … … class BP_Groups_List_Table extends WP_List_Table { 331 357 ?></h2> 332 358 333 359 <ul class="subsubsub"> 334 <li class="all"><a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'all' == $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li> 335 <li class="public"><a href="<?php echo esc_url( add_query_arg( 'group_status', 'public', $url_base ) ); ?>" class="<?php if ( 'public' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Public <span class="count">(%s)</span>', 'Public <span class="count">(%s)</span>', $this->group_counts['public'], 'buddypress' ), number_format_i18n( $this->group_counts['public'] ) ); ?></a> |</li> 336 <li class="private"><a href="<?php echo esc_url( add_query_arg( 'group_status', 'private', $url_base ) ); ?>" class="<?php if ( 'private' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', $this->group_counts['private'], 'buddypress' ), number_format_i18n( $this->group_counts['private'] ) ); ?></a> |</li> 337 <li class="hidden"><a href="<?php echo esc_url( add_query_arg( 'group_status', 'hidden', $url_base ) ); ?>" class="<?php if ( 'hidden' == $this->view ) echo 'current'; ?>"><?php printf( _n( 'Hidden <span class="count">(%s)</span>', 'Hidden <span class="count">(%s)</span>', $this->group_counts['hidden'], 'buddypress' ), number_format_i18n( $this->group_counts['hidden'] ) ); ?></a></li> 360 <li class="all"> 361 <a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'all' === $this->view ) echo 'current'; ?>"> 362 <?php printf( 363 /* translators: %s is the placeholder for the count html tag `<span class="count"/>` */ 364 esc_html__( 'All %s', 'buddypress' ), 365 sprintf( 366 '<span class="count">(%s)</span>', 367 number_format_i18n( $this->group_counts['all'] ) 368 ) 369 ); ?> 370 </a> | 371 </li> 372 <li class="public"> 373 <a href="<?php echo esc_url( add_query_arg( 'group_status', 'public', $url_base ) ); ?>" class="<?php if ( 'public' === $this->view ) echo 'current'; ?>"> 374 <?php printf( 375 /* translators: %s is the placeholder for the count html `<span class="count"/>` */ 376 _n( 'Public %s', 'Public %s', $this->group_counts['public'], 'buddypress' ), 377 sprintf( 378 '<span class="count">(%s)</span>', 379 number_format_i18n( $this->group_counts['public'] ) 380 ) 381 ); ?> 382 </a> | 383 </li> 384 <li class="private"> 385 <a href="<?php echo esc_url( add_query_arg( 'group_status', 'private', $url_base ) ); ?>" class="<?php if ( 'private' === $this->view ) echo 'current'; ?>"> 386 <?php printf( 387 /* translators: %s is the placeholder for the count html `<span class="count"/>` */ 388 _n( 'Private %s', 'Private %s', $this->group_counts['private'], 'buddypress' ), 389 sprintf( 390 '<span class="count">(%s)</span>', 391 number_format_i18n( $this->group_counts['private'] ) 392 ) 393 ); ?> 394 </a> | 395 </li> 396 <li class="hidden"> 397 <a href="<?php echo esc_url( add_query_arg( 'group_status', 'hidden', $url_base ) ); ?>" class="<?php if ( 'hidden' === $this->view ) echo 'current'; ?>"> 398 <?php printf( 399 /* translators: %s is the placeholder for the count html tag */ 400 _n( 'Hidden %s', 'Hidden %s', $this->group_counts['hidden'], 'buddypress' ), 401 sprintf( 402 '<span class="count">(%s)</span>', 403 number_format_i18n( $this->group_counts['hidden'] ) 404 ) 405 ); ?> 406 </a> 407 </li> 338 408 339 409 <?php 340 410