Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/31/2023 05:26:39 PM (13 months ago)
Author:
imath
Message:

Make sure all displayed user URLs are built using the BP Rewrites API

Replace all remaining bp_displayed_user_domain() usage in favor of
bp_displayed_user_url().
Introduce the bp_members_get_path_chunks() function to quickly build BP
Rewrites argument for member's URL using an array of slugs.
Deprecate bp_activities_member_rss_link(), bp_blogs_blog_tabs() &
bp_groups_header_tabs().
Improve bp_displayed_user_link() so that it's possible to pass an array
of slugs to output an escaped BP Rewrites ready URL.

Props r-a-y, johnjamesjacoby, boonebgorges

Closes https://github.com/buddypress/buddypress/pull/79
See #4954

File:
1 edited

Legend:

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

    r13441 r13443  
    21682168 */
    21692169function bp_group_search_form() {
    2170 
    2171     $action = bp_displayed_user_domain() . bp_get_groups_slug() . '/my-groups/search/';
    2172     $label = __('Filter Groups', 'buddypress');
    2173     $name = 'group-filter-box';
    2174 
    2175     $search_form_html = '<form action="' . $action . '" id="group-search-form" method="post">
    2176         <label for="'. $name .'" id="'. $name .'-label">'. $label .'</label>
    2177         <input type="search" name="'. $name . '" id="'. $name .'" value="'. $value .'"'.  $disabled .' />
     2170    $label       = __('Filter Groups', 'buddypress');
     2171    $name        = 'group-filter-box';
     2172    $groups_slug = bp_get_groups_slug();
     2173    $action      = bp_displayed_user_url(
     2174        array(
     2175            'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ),
     2176            'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_my_groups', 'my-groups' ),
     2177            'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_search', 'search' ) ),
     2178        )
     2179    );
     2180
     2181    $search_form_html = '<form action="' . esc_url( $action ) . '" id="group-search-form" method="post">
     2182        <label for="'. $name .'" id="'. $name .'-label">'. esc_html( $label ) .'</label>
     2183        <input type="search" name="'. $name . '" id="'. $name .'" value=""/>
    21782184
    21792185        '. wp_nonce_field( 'group-filter-box', '_wpnonce_group_filter', true, false ) .'
     
    57385744
    57395745/**
    5740  * Displays group header tabs.
    5741  *
    5742  * @since 1.0.0
    5743  *
    5744  * @todo Deprecate?
    5745  */
    5746 function bp_groups_header_tabs() {
    5747     $user_groups = bp_displayed_user_domain() . bp_get_groups_slug(); ?>
    5748 
    5749     <li<?php if ( !bp_action_variable( 0 ) || bp_is_action_variable( 'recently-active', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/recently-active' ); ?>"><?php _e( 'Recently Active', 'buddypress' ); ?></a></li>
    5750     <li<?php if ( bp_is_action_variable( 'recently-joined', 0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/recently-joined' ); ?>"><?php _e( 'Recently Joined',  'buddypress' ); ?></a></li>
    5751     <li<?php if ( bp_is_action_variable( 'most-popular',    0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/most-popular'    ); ?>"><?php _e( 'Most Popular',     'buddypress' ); ?></a></li>
    5752     <li<?php if ( bp_is_action_variable( 'admin-of',        0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/admin-of'        ); ?>"><?php _e( 'Administrator Of', 'buddypress' ); ?></a></li>
    5753     <li<?php if ( bp_is_action_variable( 'mod-of',          0 ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/mod-of'          ); ?>"><?php _e( 'Moderator Of',     'buddypress' ); ?></a></li>
    5754     <li<?php if ( bp_is_action_variable( 'alphabetically'     ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $user_groups . '/my-groups/alphabetically'  ); ?>"><?php _e( 'Alphabetically',   'buddypress' ); ?></a></li>
    5755 
    5756 <?php
    5757     do_action( 'groups_header_tabs' );
    5758 }
    5759 
    5760 /**
    57615746 * Displays group filter titles.
    57625747 *
Note: See TracChangeset for help on using the changeset viewer.