Skip to:
Content

BuddyPress.org

Changeset 9955


Ignore:
Timestamp:
06/20/2015 01:23:47 PM (5 years ago)
Author:
boonebgorges
Message:

Improve the flexibility of the separators in the action links of the groups and members widgets.

  • Introduce filters 'bp_groups_widget_separator' and 'bp_members_widget_separator' to allow customization of the default pipe character.
  • Wrap separators in a <span> element, to allow for custom styling and proper ARIA role.

Props dunhakdis, pareshradadiya, hnla.
Fixes #6513.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-widgets.php

    r9819 r9955  
    7373        $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
    7474
     75        /**
     76         * Filters the separator of the group widget links.
     77         *
     78         * @since BuddyPress (2.4.0)
     79         *
     80         * @param string $separator Separator string. Default '|'.
     81         */
     82        $separator = apply_filters( 'bp_groups_widget_separator', '|' );
     83
    7584        echo $before_widget;
    7685
     
    9099        <?php if ( bp_has_groups( $group_args ) ) : ?>
    91100            <div class="item-options" id="groups-list-options">
    92                 <a href="<?php bp_groups_directory_permalink(); ?>" id="newest-groups"<?php if ( $instance['group_default'] == 'newest' ) : ?> class="selected"<?php endif; ?>><?php _e("Newest", 'buddypress') ?></a> |
    93                 <a href="<?php bp_groups_directory_permalink(); ?>" id="recently-active-groups"<?php if ( $instance['group_default'] == 'active' ) : ?> class="selected"<?php endif; ?>><?php _e("Active", 'buddypress') ?></a> |
     101                <a href="<?php bp_groups_directory_permalink(); ?>" id="newest-groups"<?php if ( $instance['group_default'] == 'newest' ) : ?> class="selected"<?php endif; ?>><?php _e("Newest", 'buddypress') ?></a>
     102                <span class="bp-separator" role="separator"><?php echo esc_html( $separator ); ?></span>
     103                <a href="<?php bp_groups_directory_permalink(); ?>" id="recently-active-groups"<?php if ( $instance['group_default'] == 'active' ) : ?> class="selected"<?php endif; ?>><?php _e("Active", 'buddypress') ?></a>
     104                <span class="bp-separator" role="separator"><?php echo esc_html( $separator ); ?></span>
    94105                <a href="<?php bp_groups_directory_permalink(); ?>" id="popular-groups" <?php if ( $instance['group_default'] == 'popular' ) : ?> class="selected"<?php endif; ?>><?php _e("Popular", 'buddypress') ?></a>
    95106            </div>
  • trunk/src/bp-members/bp-members-widgets.php

    r9877 r9955  
    7676        $title = apply_filters( 'widget_title', $settings['title'], $settings, $this->id_base );
    7777        $title = $settings['link_title'] ? '<a href="' . bp_get_members_directory_permalink() . '">' . $title . '</a>' : $title;
     78
     79        /**
     80         * Filters the separator of the member widget links.
     81         *
     82         * @since BuddyPress (2.4.0)
     83         *
     84         * @param string $separator Separator string. Default '|'.
     85         */
     86        $separator = apply_filters( 'bp_members_widget_separator', '|' );
    7887
    7988        // Output before widget HTMl, title (and maybe content before & after it)
     
    97106            <div class="item-options" id="members-list-options">
    98107                <a href="<?php bp_members_directory_permalink(); ?>" id="newest-members" <?php if ( 'newest' === $settings['member_default'] ) : ?>class="selected"<?php endif; ?>><?php esc_html_e( 'Newest', 'buddypress' ); ?></a>
    99                 |  <a href="<?php bp_members_directory_permalink(); ?>" id="recently-active-members" <?php if ( 'active' === $settings['member_default'] ) : ?>class="selected"<?php endif; ?>><?php esc_html_e( 'Active', 'buddypress' ); ?></a>
     108                <span class="bp-separator" role="separator"><?php echo esc_html( $separator ); ?></span>
     109                <a href="<?php bp_members_directory_permalink(); ?>" id="recently-active-members" <?php if ( 'active' === $settings['member_default'] ) : ?>class="selected"<?php endif; ?>><?php esc_html_e( 'Active', 'buddypress' ); ?></a>
    100110
    101111                <?php if ( bp_is_active( 'friends' ) ) : ?>
    102 
    103                     | <a href="<?php bp_members_directory_permalink(); ?>" id="popular-members" <?php if ( 'popular' === $settings['member_default'] ) : ?>class="selected"<?php endif; ?>><?php esc_html_e( 'Popular', 'buddypress' ); ?></a>
     112                    <span class="bp-separator" role="separator"><?php echo esc_html( $separator ); ?></span>
     113                    <a href="<?php bp_members_directory_permalink(); ?>" id="popular-members" <?php if ( 'popular' === $settings['member_default'] ) : ?>class="selected"<?php endif; ?>><?php esc_html_e( 'Popular', 'buddypress' ); ?></a>
    104114
    105115                <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.