Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/31/2023 05:26:39 PM (18 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-core/deprecated/12.0.php

    r13437 r13443  
    343343    bp_group_creation_tabs();
    344344}
     345
     346/**
     347 * Displays group header tabs.
     348 *
     349 * @since 1.0.0
     350 * @deprecated 12.0.0
     351 */
     352function bp_groups_header_tabs() {
     353    _deprecated_function( __FUNCTION__, '12.0.0' );
     354    $user_groups = bp_displayed_user_url() . bp_get_groups_slug(); ?>
     355
     356    <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>
     357    <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>
     358    <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>
     359    <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>
     360    <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>
     361    <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>
     362
     363<?php
     364    /**
     365     * Fires after the markup for the navigation tabs for a user Groups page.
     366     *
     367     * @since 1.0.0
     368     * @deprecated 12.0.0
     369     */
     370    do_action_deprecated( 'groups_header_tabs', array(), '12.0.0' );
     371}
     372
     373/**
     374 * Output navigation tabs for a user Blogs page.
     375 *
     376 * Currently unused by BuddyPress.
     377 *
     378 * @since 1.0.0
     379 * @deprecated 12.0.0
     380 */
     381function bp_blogs_blog_tabs() {
     382
     383    // Don't show these tabs on a user's own profile.
     384    if ( bp_is_my_profile() ) {
     385        return false;
     386    } ?>
     387
     388    <ul class="content-header-nav">
     389        <li<?php if ( bp_is_current_action( 'my-blogs' ) || !bp_current_action() ) : ?> class="current"<?php endif; ?>>
     390            <a href="<?php bp_displayed_user_link( array( bp_get_blogs_slug(), 'my-blogs' ) ); ?>">
     391                <?php
     392                /* translators: %s: the User Display Name */
     393                printf( esc_html__( "%s's Sites", 'buddypress' ), bp_get_displayed_user_fullname() );
     394                ?>
     395            </a>
     396        </li>
     397        <li<?php if ( bp_is_current_action( 'recent-posts' ) ) : ?> class="current"<?php endif; ?>>
     398            <a href="<?php bp_displayed_user_link( array( bp_get_blogs_slug(), 'recent-posts' ) ); ?>">
     399                <?php
     400                /* translators: %s: the User Display Name */
     401                printf( esc_html__( "%s's Recent Posts", 'buddypress' ), bp_get_displayed_user_fullname() );
     402                ?>
     403            </a>
     404        </li>
     405        <li<?php if ( bp_is_current_action( 'recent-comments' ) ) : ?> class="current"<?php endif; ?>>
     406            <a href="<?php bp_displayed_user_link( array( bp_get_blogs_slug(), 'recent-comments' ) ); ?>">
     407                <?php
     408                /* translators: %s: the User Display Name */
     409                printf( esc_html__( "%s's Recent Comments", 'buddypress' ), bp_get_displayed_user_fullname() );
     410                ?>
     411            </a>
     412        </li>
     413    </ul>
     414
     415<?php
     416
     417    /**
     418     * Fires after the markup for the navigation tabs for a user Blogs page.
     419     *
     420     * @since 1.0.0
     421     * @deprecated 12.0.0
     422     */
     423    do_action_deprecated( 'bp_blogs_blog_tabs', array(), '12.0.0' );
     424}
Note: See TracChangeset for help on using the changeset viewer.