Skip to:
Content

Ticket #7526: 7526.patch

File 7526.patch, 3.8 KB (added by bhargavbhandari90, 8 months ago)

We should add the counter for consistency

  • src/bp-activity/classes/class-bp-activity-list-table.php

     
    313313                ?></h2> 
    314314 
    315315                <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> 
     316                        <li class="all"><a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php printf( __( 'All <span class="count">(%d)</span>' ), $this->count_all_activity() ); ?></a> |</li> 
    317317                        <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> 
    318318 
    319319                        <?php 
     
    855855 
    856856                return $tree; 
    857857        } 
     858 
     859        /** 
     860         * Get count for All activities tab 
     861         * 
     862         * It will show count of activities which are not spam. 
     863         * 
     864         * @return int $activity_count Count of non spam activities. 
     865         */ 
     866        public static function count_all_activity() { 
     867                global $wpdb; 
     868                $activity_count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}bp_activity WHERE `component` =  'activity' AND `is_spam` = '0'" ); 
     869                return $activity_count; 
     870        } 
    858871} 
  • src/bp-groups/classes/class-bp-groups-list-table.php

     
    331331                ?></h2> 
    332332 
    333333                <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> 
     334                        <li class="all"><a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'all' == $this->view ) echo 'current'; ?>"><?php printf( __( 'All <span class="count">(%d)</span>' ), $this->count_all_groups() ); ?></a> |</li> 
    335335                        <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> 
    336336                        <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> 
    337337                        <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> 
     
    790790                </div> 
    791791                <?php 
    792792        } 
     793 
     794        /** 
     795         * Get count for All groups tab 
     796         * 
     797         * It will show count of all groups. 
     798         * 
     799         * @return int $group_count Count of all groups. 
     800         */ 
     801        public function count_all_groups() { 
     802                $group_count = $this->group_counts['public'] + $this->group_counts['private'] + $this->group_counts['hidden']; 
     803                return $group_count; 
     804        } 
    793805}