- Timestamp:
- 02/25/2020 11:51:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-list-table.php
r12542 r12551 40 40 41 41 /** 42 * Total number of activities. 43 * 44 * @since 6.0.0 45 * @var int $all_count 46 */ 47 public $all_count = 0; 48 49 /** 42 50 * Store activity-to-user-ID mappings for use in the In Response To column. 43 51 * … … 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 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 112 113 113 // Filter. 114 114 if ( ! empty( $_REQUEST['activity_type'] ) ) { 115 115 $filter = array( 'action' => $_REQUEST['activity_type'] ); 116 117 // Set the view as a filtered one. 118 $this->view = 'filtered'; 116 119 117 120 /** … … 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']; 149 150 // Set the view as a single activity. 151 $this->view = 'single'; 152 } 142 153 143 154 // Get the spam total (ignoring any search query or filter). … … 161 172 'filter_query' => $filter_query, 162 173 'show_hidden' => true, 163 // 'sort' => $sort,164 174 'spam' => $spam, 165 175 'count_total' => 'count_query', … … 185 195 186 196 // Set raw data to display. 187 $this->items = $new_activities;197 $this->items = $new_activities; 188 198 189 199 // Store information needed for handling table pagination. … … 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 … … 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
Note: See TracChangeset
for help on using the changeset viewer.