Skip to:
Content

BuddyPress.org

Ticket #7352: 7352.patch

File 7352.patch, 14.7 KB (added by hnla, 8 years ago)
  • src/bp-groups/bp-groups-template.php

     
    45224522 * @since 2.0.0
    45234523 */
    45244524function bp_groups_members_filter() {
    4525         ?>
    4526         <li id="group_members-order-select" class="last filter">
    4527                 <label for="group_members-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>
    4528                 <select id="group_members-order-by">
    4529                         <option value="last_joined"><?php _e( 'Newest', 'buddypress' ); ?></option>
    4530                         <option value="first_joined"><?php _e( 'Oldest', 'buddypress' ); ?></option>
    45314525
    4532                         <?php if ( bp_is_active( 'activity' ) ) : ?>
    4533                                 <option value="group_activity"><?php _e( 'Group Activity', 'buddypress' ); ?></option>
    4534                         <?php endif; ?>
     4526        bp_get_template_part('common/filters/select-order-filters');
    45354527
    4536                         <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
    4537 
    4538                         <?php
    4539 
    4540                         /**
    4541                          * Fires at the end of the Group members filters select input.
    4542                          *
    4543                          * Useful for plugins to add more filter options.
    4544                          *
    4545                          * @since 2.0.0
    4546                          */
    4547                         do_action( 'bp_groups_members_order_options' ); ?>
    4548 
    4549                 </select>
    4550         </li>
    4551         <?php
    45524528}
    45534529
    45544530/*
  • src/bp-templates/bp-legacy/buddypress/activity/index.php

     
    153153                         */
    154154                        do_action( 'bp_activity_syndication_options' ); ?>
    155155
    156                         <li id="activity-filter-select" class="last">
    157                                 <label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label>
    158                                 <select id="activity-filter-by">
    159                                         <option value="-1"><?php _e( '&mdash; Everything &mdash;', 'buddypress' ); ?></option>
    160 
    161                                         <?php bp_activity_show_filters(); ?>
    162 
    163                                         <?php
    164 
    165                                         /**
    166                                          * Fires inside the select input for activity filter by options.
    167                                          *
    168                                          * @since 1.2.0
    169                                          */
    170                                         do_action( 'bp_activity_filter_options' ); ?>
    171 
    172                                 </select>
    173                         </li>
     156                        <?php bp_get_template_part('common/filters/select-order-filters'); ?>
    174157                </ul>
    175158        </div><!-- .item-list-tabs -->
    176159
  • src/bp-templates/bp-legacy/buddypress/blogs/index.php

     
    9191                                 */
    9292                                do_action( 'bp_blogs_directory_blog_sub_types' ); ?>
    9393
    94                                 <li id="blogs-order-select" class="last filter">
    95 
    96                                         <label for="blogs-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>
    97                                         <select id="blogs-order-by">
    98                                                 <option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option>
    99                                                 <option value="newest"><?php _e( 'Newest', 'buddypress' ); ?></option>
    100                                                 <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
    101 
    102                                                 <?php
    103 
    104                                                 /**
    105                                                  * Fires inside the select input listing blogs orderby options.
    106                                                  *
    107                                                  * @since 1.2.0
    108                                                  */
    109                                                 do_action( 'bp_blogs_directory_order_options' ); ?>
    110 
    111                                         </select>
    112                                 </li>
     94                                <?php bp_get_template_part('common/filters/select-order-filters'); ?>
    11395                        </ul>
    11496                </div>
    11597
  • src/bp-templates/bp-legacy/buddypress/common/filters/select-order-filters.php

     
     1<?php
     2/**
     3* Build Select / Order By filters
     4*
     5* @since 2.8.0
     6*/
     7
     8/**
     9 * Check current components & actions
     10 *
     11 * Build id's, labels.
     12 *
     13 * @since 2.8.0
     14 */
     15function bp_current_object_parts() {
     16        $current_component = bp_current_component();
     17        $current_action    = bp_current_action();
     18        $component = array();
     19
     20                $component['object']    = $current_component;
     21
     22                if ( bp_is_group() ) :
     23                        $component['li_id']     = 'groups_members-order-select';
     24                        $component['select_id'] = 'groups_members-order-select';
     25                        $component['order_by']  = 'groups_members-order-by';
     26                        $component['object']    = $current_action;
     27
     28                elseif( 'activity' === $current_component ) :
     29                        $component['li_id']     = bp_current_component() . '-filter-select';
     30                        $component['select_id'] = $current_component . '-filter-by';
     31
     32                elseif( 'friends' == $current_component) :
     33                        $component['li_id']     = 'members-order-select';
     34                        $component['select_id'] = 'members-friends';
     35
     36                elseif( 'notifications' === $current_component ) :
     37                        $component['li_id']     = 'members-order-select';
     38                        $component['select_id'] = 'notifications-sort-order-list';
     39
     40                else:
     41                        $component['li_id']     = $current_component . '-order-select';
     42                        $component['select_id'] = $current_component . '-order-by';
     43                endif;
     44
     45                if ( 'activity' === $component['object'] || 'friends' === $component['object'] ) :
     46                        $component['label'] = __( 'Show:', 'buddypress' );;
     47                else:
     48                        $component['label'] = __( 'Order By:', 'buddypress' );
     49                endif;
     50
     51                return (object) $component;
     52}
     53$component = bp_current_object_parts();
     54?>
     55
     56
     57<?php
     58// Output the markup for filters.
     59// Notifications builds it's own complete form markup in bp-notifications-template.php
     60?>
     61<li id="<?php echo $component->li_id; ?>" class="last filter">
     62
     63        <?php if( 'notifications' === $component->object ) :
     64                bp_component_filters();
     65        else: ?>
     66
     67        <label for="<?php echo $component->select_id; ?>"><?php echo $component->label ?></label>
     68        <select id="<?php echo $component->select_id; ?>">
     69
     70                <?php bp_component_filters(); ?>
     71
     72        </select>
     73
     74        <?php endif; ?>
     75
     76</li>
     77
     78
     79<?php
     80/**
     81 * The Component option filters
     82 *
     83 * @since 2.8.0
     84*/
     85
     86function bp_component_filters() {
     87        echo bp_get_component_filters();
     88}
     89
     90function bp_get_component_filters() {
     91
     92$component = bp_current_object_parts();
     93
     94        switch ( $component->object ) {
     95                case 'activity':
     96
     97                        if(  ! bp_is_group() ) { ?>
     98                                <option value="-1"><?php _e( '&mdash; Everything &mdash;', 'buddypress' ); ?></option>
     99                        <?php }
     100
     101                        bp_activity_show_filters();
     102
     103                        /**
     104                                * Fires inside the select input for activity filter by options.
     105                                *
     106                                * @since 1.2.0
     107                                */
     108                        do_action( 'bp_activity_filter_options' );
     109                break;
     110
     111                case 'blogs' :
     112                        bp_get_order_by_options();
     113
     114                        /**
     115                                * Fires inside the select input listing blogs orderby options.
     116                                *
     117                                * @since 1.2.0
     118                                */
     119                        do_action( 'bp_blogs_directory_order_options' );
     120                break;
     121
     122                case 'groups' :
     123                        bp_get_order_by_options();
     124
     125                        /**
     126                                * Fires inside the groups directory group order options.
     127                                *
     128                                * @since 1.2.0
     129                                */
     130                        do_action( 'bp_groups_directory_order_options' );
     131                break;
     132
     133                case 'members' :
     134                        if( bp_is_group() ) {
     135
     136                                bp_get_order_by_options();
     137
     138                                /**
     139                                        * Fires inside the members group order options select input.
     140                                        *
     141                                        * @since 1.2.0
     142                                        */
     143                                        do_action( 'bp_member_group_order_options' );
     144
     145                        } else {
     146
     147                                bp_get_order_by_options();
     148
     149                                /**
     150                                        * Fires inside the members directory member order options.
     151                                        *
     152                                        * @since 1.2.0
     153                                        */
     154                                        do_action( 'bp_members_directory_order_options' );
     155                        }
     156                break;
     157
     158                case 'friends' :
     159                        bp_get_order_by_options();
     160
     161                        /**
     162                                * Fires inside the members friends order options select input.
     163                                *
     164                                * @since 2.0.0
     165                                */
     166                                do_action( 'bp_member_friends_order_options' );
     167                break;
     168
     169                case 'notifications' :
     170                        bp_notifications_sort_order_form();
     171
     172                break;
     173
     174        }
     175
     176        return;
     177}
     178
     179/**
     180 * Order by option elements
     181 *
     182 * @since 2.8.0
     183*/
     184function bp_get_order_by_options() {
     185        $component = bp_current_object_parts();
     186
     187        // Labels change depending on the component or action
     188        // so build labels here to use in returned markup.
     189        $label = array();
     190        $label['active']  = __( 'Last Active', 'buddypress' );
     191        $label['popular'] = __('Most Members', 'buddypress');
     192        $label['group_activity'] = __('Group Activity', 'buddypress');
     193
     194        if( 'groups' === $component->object ) {
     195                $label['newest'] = __('Newly Created', 'buddypress');
     196
     197        } elseif('members' === $component->object ) {
     198                $label['newest'] = __('Newest Registered', 'buddypress');
     199
     200        } else {
     201                $label['newest'] = __('Newest', 'buddypress');
     202        }
     203
     204        $label['alphabetical'] = __('Alphabetical', 'buddypress');
     205        ?>
     206
     207        <?php if( bp_is_group() && 'members' === $component->object ) { ?>
     208                <option value="last_joined"><?php _e( 'Newest', 'buddypress' ); ?></option>
     209                <option value="first_joined"><?php _e( 'Oldest', 'buddypress' ); ?></option>
     210        <?php } ?>
     211
     212        <?php if ( bp_is_active( 'activity' ) && bp_is_group() ) : ?>
     213                <option value="group_activity"><?php echo $label['group_activity']; ?></option>
     214
     215        <?php else: ?>
     216                <option value="active"><?php echo $label['active']; ?></option>
     217        <?php endif; ?>
     218
     219        <?php if( 'groups' === $component->object ) { ?>
     220                <option value="popular"><?php echo $label['popular']; ?></option>
     221        <?php } ?>
     222
     223        <?php if( !bp_is_group() ) { ?>
     224                <option value="newest"><?php echo $label['newest']; ?></option>
     225        <?php } ?>
     226
     227<?php           if( 'members' === $component->object && bp_is_active('xprofile') ) { ?>
     228                <option value="alphabetical"><?php echo $label['alphabetical']; ?></option>
     229<?php   } else { ?>
     230                <option value="alphabetical"><?php echo $label['alphabetical']; ?></option>
     231<?php } ?>
     232
     233        <?php
     234        return;
     235}
  • src/bp-templates/bp-legacy/buddypress/groups/index.php

     
    8787                                 */
    8888                                do_action( 'bp_groups_directory_group_types' ); ?>
    8989
    90                                 <li id="groups-order-select" class="last filter">
    91 
    92                                         <label for="groups-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>
    93 
    94                                         <select id="groups-order-by">
    95                                                 <option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option>
    96                                                 <option value="popular"><?php _e( 'Most Members', 'buddypress' ); ?></option>
    97                                                 <option value="newest"><?php _e( 'Newly Created', 'buddypress' ); ?></option>
    98                                                 <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
    99 
    100                                                 <?php
    101 
    102                                                 /**
    103                                                  * Fires inside the groups directory group order options.
    104                                                  *
    105                                                  * @since 1.2.0
    106                                                  */
    107                                                 do_action( 'bp_groups_directory_order_options' ); ?>
    108                                         </select>
    109                                 </li>
     90                                <?php bp_get_template_part('common/filters/select-order-filters'); ?>
    11091                        </ul>
    11192                </div>
    11293
  • src/bp-templates/bp-legacy/buddypress/members/index.php

     
    8787                                 */
    8888                                do_action( 'bp_members_directory_member_sub_types' ); ?>
    8989
    90                                 <li id="members-order-select" class="last filter">
    91                                         <label for="members-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>
    92                                         <select id="members-order-by">
    93                                                 <option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option>
    94                                                 <option value="newest"><?php _e( 'Newest Registered', 'buddypress' ); ?></option>
    95 
    96                                                 <?php if ( bp_is_active( 'xprofile' ) ) : ?>
    97                                                         <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
    98                                                 <?php endif; ?>
    99 
    100                                                 <?php
    101 
    102                                                 /**
    103                                                  * Fires inside the members directory member order options.
    104                                                  *
    105                                                  * @since 1.2.0
    106                                                  */
    107                                                 do_action( 'bp_members_directory_order_options' ); ?>
    108                                         </select>
    109                                 </li>
     90                                <?php bp_get_template_part('common/filters/select-order-filters'); ?>
    11091                        </ul>
    11192                </div>
    11293
  • src/bp-templates/bp-legacy/buddypress/members/single/friends.php

     
    1414
    1515                <?php if ( !bp_is_current_action( 'requests' ) ) : ?>
    1616
    17                         <li id="members-order-select" class="last filter">
     17                <?php bp_get_template_part('common/filters/select-order-filters'); ?>
    1818
    19                                 <label for="members-friends"><?php _e( 'Order By:', 'buddypress' ); ?></label>
    20                                 <select id="members-friends">
    21                                         <option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option>
    22                                         <option value="newest"><?php _e( 'Newest Registered', 'buddypress' ); ?></option>
    23                                         <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
    24 
    25                                         <?php
    26 
    27                                         /**
    28                                          * Fires inside the members friends order options select input.
    29                                          *
    30                                          * @since 2.0.0
    31                                          */
    32                                         do_action( 'bp_member_friends_order_options' ); ?>
    33 
    34                                 </select>
    35                         </li>
    36 
    3719                <?php endif; ?>
    3820
    3921        </ul>
  • src/bp-templates/bp-legacy/buddypress/members/single/groups.php

     
    1414
    1515                <?php if ( !bp_is_current_action( 'invites' ) ) : ?>
    1616
    17                         <li id="groups-order-select" class="last filter">
     17                <?php bp_get_template_part('common/filters/select-order-filters'); ?>
    1818
    19                                 <label for="groups-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label>
    20                                 <select id="groups-order-by">
    21                                         <option value="active"><?php _e( 'Last Active', 'buddypress' ); ?></option>
    22                                         <option value="popular"><?php _e( 'Most Members', 'buddypress' ); ?></option>
    23                                         <option value="newest"><?php _e( 'Newly Created', 'buddypress' ); ?></option>
    24                                         <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
    25 
    26                                         <?php
    27 
    28                                         /**
    29                                          * Fires inside the members group order options select input.
    30                                          *
    31                                          * @since 1.2.0
    32                                          */
    33                                         do_action( 'bp_member_group_order_options' ); ?>
    34 
    35                                 </select>
    36                         </li>
    37 
    3819                <?php endif; ?>
    3920
    4021        </ul>
  • src/bp-templates/bp-legacy/buddypress/members/single/notifications.php

     
    1212        <ul>
    1313                <?php bp_get_options_nav(); ?>
    1414
    15                 <li id="members-order-select" class="last filter">
    16                         <?php bp_notifications_sort_order_form(); ?>
    17                 </li>
     15                <?php bp_get_template_part('common/filters/select-order-filters'); ?>
    1816        </ul>
    1917</div>
    2018