Skip to:
Content

BuddyPress.org

Ticket #5300: 5300.patch

File 5300.patch, 3.1 KB (added by boonebgorges, 12 years ago)
  • bp-notifications/bp-notifications-classes.php

    diff --git bp-notifications/bp-notifications-classes.php bp-notifications/bp-notifications-classes.php
    index 5be2531..6cb4af0 100644
    class BP_Notifications_Notification { 
    321321                        $where_conditions['is_new'] = "is_new = 0";
    322322                }
    323323
     324                // active
     325                if ( ! empty( $args['active'] ) ) {
     326                        $active_components = array_keys( buddypress()->active_components );
     327
     328                        $ac_clean = array();
     329                        foreach ( $active_components as $ac ) {
     330                                $ac_clean[] = $wpdb->prepare( '%s', $ac );
     331                        }
     332
     333                        $ac_in = implode( ',', $ac_clean );
     334                        $where_conditions['active'] = "component_name IN ({$ac_in})";
     335                }
     336
    324337                // search_terms
    325338                if ( ! empty( $args['search_terms'] ) ) {
    326339                        $search_terms = like_escape( esc_sql( $args['search_terms'] ) );
    class BP_Notifications_Notification { 
    556569                        'component_name'    => false,
    557570                        'component_action'  => false,
    558571                        'is_new'            => true,
     572                        'active'            => true,
    559573                        'search_terms'      => '',
    560574                        'order_by'          => false,
    561575                        'sort_order'        => false,
    class BP_Notifications_Notification { 
    578592                        'component_name'    => $r['component_name'],
    579593                        'component_action'  => $r['component_action'],
    580594                        'is_new'            => $r['is_new'],
     595                        'active'            => $r['active'],
    581596                        'search_terms'      => $r['search_terms'],
    582597                ) );
    583598
    class BP_Notifications_Notification { 
    759774                $r = wp_parse_args( $args, array(
    760775                        'user_id'      => bp_loggedin_user_id(),
    761776                        'is_new'       => true,
     777                        'active'       => true,
    762778                        'page'         => 1,
    763779                        'per_page'     => 25,
    764780                        'search_terms' => '',
  • bp-notifications/bp-notifications-template.php

    diff --git bp-notifications/bp-notifications-template.php bp-notifications/bp-notifications-template.php
    index 2ca2610..22dbe38 100644
    class BP_Notifications_Template { 
    244244                $r = wp_parse_args( $args, array(
    245245                        'user_id'      => 0,
    246246                        'is_new'       => true,
     247                        'active'       => true,
    247248                        'page'         => 1,
    248249                        'per_page'     => 25,
    249250                        'order_by'     => 'date_notified',
    class BP_Notifications_Template { 
    282283                $this->pag_num      = $pag_num;
    283284                $this->user_id      = $r['user_id'];
    284285                $this->is_new       = $r['is_new'];
     286                $this->active       = $r['active'];
    285287                $this->search_terms = $r['search_terms'];
    286288                $this->page_arg     = $r['page_arg'];
    287289                $this->order_by     = $r['order_by'];
    class BP_Notifications_Template { 
    291293                $notifications      = BP_Notifications_Notification::get_current_notifications_for_user( array(
    292294                        'user_id'      => $this->user_id,
    293295                        'is_new'       => $this->is_new,
     296                        'active'       => $this->active,
    294297                        'page'         => $this->pag_page,
    295298                        'per_page'     => $this->pag_num,
    296299                        'search_terms' => $this->search_terms,
    function bp_has_notifications( $args = '' ) { 
    481484        $r = wp_parse_args( $args, array(
    482485                'user_id'      => $user_id,
    483486                'is_new'       => $is_new,
     487                'active'       => true,
    484488                'page'         => 1,
    485489                'per_page'     => 25,
    486490                'max'          => false,