Skip to:
Content

BuddyPress.org

Changeset 13443


Ignore:
Timestamp:
03/31/2023 05:26:39 PM (4 years 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

Location:
trunk/src
Files:
50 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/actions/feeds.php

    r13433 r13443  
    2525
    2626        // Setup the feed.
    27         buddypress()->activity->feed = new BP_Activity_Feed( array(
    28                 'id'            => 'sitewide',
    29 
    30                 /* translators: %s Site Name */
    31                 'title'         => sprintf( __( '%s | Site-Wide Activity', 'buddypress' ), bp_get_site_name() ),
    32                 'link'          => $link,
    33                 'description'   => __( 'Activity feed for the entire site.', 'buddypress' ),
    34                 'activity_args' => 'display_comments=threaded'
    35         ) );
     27        buddypress()->activity->feed = new BP_Activity_Feed(
     28                array(
     29                        'id'            => 'sitewide',
     30
     31                        /* translators: %s Site Name */
     32                        'title'         => sprintf( __( '%s | Site-Wide Activity', 'buddypress' ), bp_get_site_name() ),
     33                        'link'          => $link,
     34                        'description'   => __( 'Activity feed for the entire site.', 'buddypress' ),
     35                        'activity_args' => 'display_comments=threaded'
     36                )
     37        );
    3638
    3739        if ( ! buddypress()->activity->feed->enabled ) {
    … …  
    5355        }
    5456
    55         $link = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() );
    56 
    57         // Setup the feed.
    58         buddypress()->activity->feed = new BP_Activity_Feed( array(
    59                 'id'            => 'personal',
    60 
    61                 /* translators: 1: Site Name. 2: User Display Name. */
    62                 'title'         => sprintf( _x( '%1$s | %2$s | Activity', 'Personal activity feed title', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    63                 'link'          => $link,
    64 
    65                 /* translators: %s: User Display Name */
    66                 'description'   => sprintf( __( 'Activity feed for %s.', 'buddypress' ), bp_get_displayed_user_fullname() ),
    67                 'activity_args' => 'user_id=' . bp_displayed_user_id()
    68         ) );
     57        $activity_slug = bp_get_activity_slug();
     58        $link          = bp_displayed_user_url(
     59                array(
     60                        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ),
     61                )
     62        );
     63
     64        // Setup the feed.
     65        buddypress()->activity->feed = new BP_Activity_Feed(
     66                array(
     67                        'id'            => 'personal',
     68
     69                        /* translators: 1: Site Name. 2: User Display Name. */
     70                        'title'         => sprintf( _x( '%1$s | %2$s | Activity', 'Personal activity feed title', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
     71                        'link'          => $link,
     72
     73                        /* translators: %s: User Display Name */
     74                        'description'   => sprintf( __( 'Activity feed for %s.', 'buddypress' ), bp_get_displayed_user_fullname() ),
     75                        'activity_args' => 'user_id=' . bp_displayed_user_id()
     76                )
     77        );
    6978
    7079        if ( ! buddypress()->activity->feed->enabled ) {
    … …  
    8695        }
    8796
    88         $link = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() );
    89 
    90         // Setup the feed.
    91         buddypress()->activity->feed = new BP_Activity_Feed( array(
    92                 'id'            => 'friends',
    93 
    94                 /* translators: 1: Site Name 2: User Display Name */
    95                 'title'         => sprintf( __( '%1$s | %2$s | Friends Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    96                 'link'          => $link,
    97 
    98                 /* translators: %s: User Display Name */
    99                 'description'   => sprintf( __( "Activity feed for %s's friends.", 'buddypress' ), bp_get_displayed_user_fullname() ),
    100                 'activity_args' => 'scope=friends'
    101         ) );
     97        $activity_slug = bp_get_activity_slug();
     98        $friends_slug  = bp_get_friends_slug();
     99        $link          = bp_displayed_user_url(
     100                array(
     101                        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ),
     102                        'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_' . $friends_slug, $friends_slug ),
     103                )
     104        );
     105
     106        // Setup the feed.
     107        buddypress()->activity->feed = new BP_Activity_Feed(
     108                array(
     109                        'id'            => 'friends',
     110
     111                        /* translators: 1: Site Name 2: User Display Name */
     112                        'title'         => sprintf( __( '%1$s | %2$s | Friends Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
     113                        'link'          => $link,
     114
     115                        /* translators: %s: User Display Name */
     116                        'description'   => sprintf( __( "Activity feed for %s's friends.", 'buddypress' ), bp_get_displayed_user_fullname() ),
     117                        'activity_args' => 'scope=friends'
     118                )
     119        );
    102120
    103121        if ( ! buddypress()->activity->feed->enabled ) {
    … …  
    120138
    121139        // Get displayed user's group IDs.
    122         $groups    = groups_get_user_groups();
    123         $group_ids = implode( ',', $groups['groups'] );
    124         $link      = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() );
    125 
    126         // Setup the feed.
    127         buddypress()->activity->feed = new BP_Activity_Feed( array(
    128                 'id'            => 'mygroups',
    129 
    130                 /* translators: 1: Site Name 2: User Display Name */
    131                 'title'         => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    132                 'link'          => $link,
    133 
    134                 /* translators: %s: User Display Name */
    135                 'description'   => sprintf( __( "Public group activity feed of which %s is a member.", 'buddypress' ), bp_get_displayed_user_fullname() ),
    136                 'activity_args' => array(
    137                         'object'           => buddypress()->groups->id,
    138                         'primary_id'       => $group_ids,
    139                         'display_comments' => 'threaded'
    140                 )
    141         ) );
     140        $groups        = groups_get_user_groups();
     141        $group_ids     = implode( ',', $groups['groups'] );
     142        $activity_slug = bp_get_activity_slug();
     143        $groups_slug   = bp_get_groups_slug();
     144        $link          = bp_displayed_user_url(
     145                array(
     146                        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ),
     147                        'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_' . $groups_slug, $groups_slug ),
     148                )
     149        );
     150
     151        // Setup the feed.
     152        buddypress()->activity->feed = new BP_Activity_Feed(
     153                array(
     154                        'id'            => 'mygroups',
     155
     156                        /* translators: 1: Site Name 2: User Display Name */
     157                        'title'         => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
     158                        'link'          => $link,
     159
     160                        /* translators: %s: User Display Name */
     161                        'description'   => sprintf( __( 'Public group activity feed of which %s is a member.', 'buddypress' ), bp_get_displayed_user_fullname() ),
     162                        'activity_args' => array(
     163                                'object'           => buddypress()->groups->id,
     164                                'primary_id'       => $group_ids,
     165                                'display_comments' => 'threaded'
     166                        )
     167                )
     168        );
    142169
    143170        if ( ! buddypress()->activity->feed->enabled ) {
    … …  
    163190        }
    164191
    165         $link = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions' );
    166 
    167         // Setup the feed.
    168         buddypress()->activity->feed = new BP_Activity_Feed( array(
    169                 'id'            => 'mentions',
    170 
    171                 /* translators: 1: Site Name 2: User Display Name */
    172                 'title'         => sprintf( __( '%1$s | %2$s | Mentions', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    173                 'link'          => $link,
    174 
    175                 /* translators: %s: User Display Name */
    176                 'description'   => sprintf( __( "Activity feed mentioning %s.", 'buddypress' ), bp_get_displayed_user_fullname() ),
    177                 'activity_args' => array(
    178                         'search_terms' => '@' . bp_members_get_user_slug( bp_displayed_user_id() )
    179                 )
    180         ) );
     192        $activity_slug = bp_get_activity_slug();
     193        $link          = bp_displayed_user_url(
     194                array(
     195                        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ),
     196                        'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_mentions', 'mentions' ),
     197                )
     198        );
     199
     200        // Setup the feed.
     201        buddypress()->activity->feed = new BP_Activity_Feed(
     202                array(
     203                        'id'            => 'mentions',
     204
     205                        /* translators: 1: Site Name 2: User Display Name */
     206                        'title'         => sprintf( __( '%1$s | %2$s | Mentions', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
     207                        'link'          => $link,
     208
     209                        /* translators: %s: User Display Name */
     210                        'description'   => sprintf( __( "Activity feed mentioning %s.", 'buddypress' ), bp_get_displayed_user_fullname() ),
     211                        'activity_args' => array(
     212                                'search_terms' => '@' . bp_members_get_user_slug( bp_displayed_user_id() )
     213                        )
     214                )
     215        );
    181216
    182217        if ( ! buddypress()->activity->feed->enabled ) {
    … …  
    199234
    200235        // Get displayed user's favorite activity IDs.
    201         $favs    = bp_activity_get_user_favorites( bp_displayed_user_id() );
    202         $fav_ids = implode( ',', (array) $favs );
    203         $link    = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites' );
    204 
    205         // Setup the feed.
    206         buddypress()->activity->feed = new BP_Activity_Feed( array(
    207                 'id'            => 'favorites',
    208 
    209                 /* translators: 1: Site Name 2: User Display Name */
    210                 'title'         => sprintf( __( '%1$s | %2$s | Favorites', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
    211                 'link'          => $link,
    212 
    213                 /* translators: %s: User Display Name */
    214                 'description'   => sprintf( __( "Activity feed of %s's favorites.", 'buddypress' ), bp_get_displayed_user_fullname() ),
    215                 'activity_args' => 'include=' . $fav_ids
    216         ) );
     236        $favs          = bp_activity_get_user_favorites( bp_displayed_user_id() );
     237        $fav_ids       = implode( ',', (array) $favs );
     238        $activity_slug = bp_get_activity_slug();
     239        $link          = bp_displayed_user_url(
     240                array(
     241                        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ),
     242                        'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_favorites', 'favorites' ),
     243                )
     244        );
     245
     246        // Setup the feed.
     247        buddypress()->activity->feed = new BP_Activity_Feed(
     248                array(
     249                        'id'            => 'favorites',
     250
     251                        /* translators: 1: Site Name 2: User Display Name */
     252                        'title'         => sprintf( __( '%1$s | %2$s | Favorites', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ),
     253                        'link'          => $link,
     254
     255                        /* translators: %s: User Display Name */
     256                        'description'   => sprintf( __( "Activity feed of %s's favorites.", 'buddypress' ), bp_get_displayed_user_fullname() ),
     257                        'activity_args' => 'include=' . $fav_ids
     258                )
     259        );
    217260
    218261        if ( ! buddypress()->activity->feed->enabled ) {
  • trunk/src/bp-activity/bp-activity-template.php

    r13437 r13443  
    39093909 *
    39103910 * @since 1.2.0
    3911  *
    39123911 */
    39133912function bp_member_activity_feed_link() {
    3914         echo bp_get_member_activity_feed_link();
    3915 }
    3916 
    3917 /**
    3918  * Output the member activity feed link.
    3919  *
    3920  * @since 1.0.0
    3921  * @deprecated 1.2.0
    3922  *
    3923  * @todo properly deprecate in favor of bp_member_activity_feed_link().
    3924  *
    3925  */
    3926 function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link(); }
     3913        echo esc_url( bp_get_member_activity_feed_link() );
     3914}
    39273915
    39283916        /**
    … …  
    39313919         * @since 1.2.0
    39323920         *
    3933          *
    39343921         * @return string $link The member activity feed link.
    39353922         */
    39363923        function bp_get_member_activity_feed_link() {
     3924                $activity_slug = bp_get_activity_slug();
     3925                $path_chunks   = array(
     3926                        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ),
     3927                );
    39373928
    39383929                // Single member activity feed link.
    39393930                if ( bp_is_profile_component() || bp_is_current_action( 'just-me' ) ) {
    3940                         $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/feed/';
     3931                        $path_chunks['single_item_action'] = 'feed';
     3932                        $link                              = bp_displayed_user_url( $path_chunks );
    39413933
    39423934                // Friend feed link.
    39433935                } elseif ( bp_is_active( 'friends' ) && bp_is_current_action( bp_get_friends_slug() ) ) {
    3944                         $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed/';
     3936                        $friends_slug                                = bp_get_friends_slug();
     3937                        $path_chunks['single_item_action']           = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_' . $friends_slug, $friends_slug );
     3938                        $path_chunks['single_item_action_variables'] = array( 'feed' );
     3939                        $link                                        = bp_displayed_user_url( $path_chunks );
    39453940
    39463941                // Group feed link.
    39473942                } elseif ( bp_is_active( 'groups'  ) && bp_is_current_action( bp_get_groups_slug()  ) ) {
    3948                         $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/';
     3943                        $groups_slug                                 = bp_get_groups_slug();
     3944                        $path_chunks['single_item_action']           = bp_rewrites_get_slug( 'members', 'member_' . $activity_slug . '_' . $groups_slug, $groups_slug );
     3945                        $path_chunks['single_item_action_variables'] = array( 'feed' );
     3946                        $link                                        = bp_displayed_user_url( $path_chunks );
    39493947
    39503948                // Favorites activity feed link.
    39513949                } elseif ( 'favorites' === bp_current_action() ) {
    3952                         $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
     3950                        $path_chunks['single_item_action']           = bp_rewrites_get_slug( 'members', 'member_'  . $activity_slug . '_favorites', 'favorites' );
     3951                        $path_chunks['single_item_action_variables'] = array( 'feed' );
     3952                        $link                                        = bp_displayed_user_url( $path_chunks );
    39533953
    39543954                // Mentions activity feed link.
    39553955                } elseif ( ( 'mentions' === bp_current_action() ) && bp_activity_do_mentions() ) {
    3956                         $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
     3956                        $path_chunks['single_item_action']           = bp_rewrites_get_slug( 'members', 'member_'  . $activity_slug . '_mentions', 'mentions' );
     3957                        $path_chunks['single_item_action_variables'] = array( 'feed' );
     3958                        $link                                        = bp_displayed_user_url( $path_chunks );
    39573959
    39583960                // No feed link.
  • trunk/src/bp-blogs/bp-blogs-template.php

    r13436 r13443  
    13871387
    13881388/**
    1389  * Output navigation tabs for a user Blogs page.
    1390  *
    1391  * Currently unused by BuddyPress.
    1392  */
    1393 function bp_blogs_blog_tabs() {
    1394 
    1395         // Don't show these tabs on a user's own profile.
    1396         if ( bp_is_my_profile() ) {
    1397                 return false;
    1398         } ?>
    1399 
    1400         <ul class="content-header-nav">
    1401                 <li<?php if ( bp_is_current_action( 'my-blogs' ) || !bp_current_action() ) : ?> class="current"<?php endif; ?>>
    1402                         <a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_blogs_slug() . '/my-blogs' ); ?>">
    1403                                 <?php
    1404                                 /* translators: %s: the User Display Name */
    1405                                 printf( __( "%s's Sites", 'buddypress' ), bp_get_displayed_user_fullname() );
    1406                                 ?>
    1407                         </a>
    1408                 </li>
    1409                 <li<?php if ( bp_is_current_action( 'recent-posts' ) ) : ?> class="current"<?php endif; ?>>
    1410                         <a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_blogs_slug() . '/recent-posts'    ); ?>">
    1411                                 <?php
    1412                                 /* translators: %s: the User Display Name */
    1413                                 printf( __( "%s's Recent Posts", 'buddypress' ), bp_get_displayed_user_fullname() );
    1414                                 ?>
    1415                         </a>
    1416                 </li>
    1417                 <li<?php if ( bp_is_current_action( 'recent-comments' ) ) : ?> class="current"<?php endif; ?>>
    1418                         <a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_blogs_slug() . '/recent-comments' ); ?>">
    1419                                 <?php
    1420                                 /* translators: %s: the User Display Name */
    1421                                 printf( __( "%s's Recent Comments", 'buddypress' ), bp_get_displayed_user_fullname() );
    1422                                 ?>
    1423                         </a>
    1424                 </li>
    1425         </ul>
    1426 
    1427 <?php
    1428 
    1429         /**
    1430          * Fires after the markup for the navigation tabs for a user Blogs page.
    1431          *
    1432          * @since 1.0.0
    1433          */
    1434         do_action( 'bp_blogs_blog_tabs' );
    1435 }
    1436 
    1437 /**
    14381389 * Output the blog directory search form.
     1390 *
     1391 * @since 1.9.0
    14391392 */
    14401393function bp_directory_blogs_search_form() {
  • trunk/src/bp-core/bp-core-buddybar.php

    r13441 r13443  
    751751                                if ( bp_is_my_profile() || ( isset( $parent_nav_default_item ) && $parent_nav_default_item->show_for_displayed_user ) ) {
    752752                                        $message     = __( 'You do not have access to that page.', 'buddypress' );
    753                                         $redirect_to = bp_displayed_user_domain();
     753                                        $redirect_to = bp_displayed_user_url();
    754754
    755755                                // In some cases, the default tab is not accessible to
    … …  
    759759                                        // Try 'activity' first.
    760760                                        if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) {
    761                                                 $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() );
     761                                                $activity_slug = bp_get_activity_slug();
     762                                                $redirect_to   = bp_displayed_user_url(
     763                                                        array(
     764                                                                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $activity_slug, $activity_slug ),
     765                                                        )
     766                                                );
    762767                                        // Then try 'profile'.
    763768                                        } else {
    764                                                 $redirect_to = trailingslashit( bp_displayed_user_domain() . ( 'xprofile' == $bp->profile->id ? 'profile' : $bp->profile->id ) );
     769                                                $profile_slug  = bp_get_profile_slug();
     770                                                $redirect_to   = bp_displayed_user_url(
     771                                                        array(
     772                                                                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ),
     773                                                        )
     774                                                );
    765775                                        }
    766776
    767                                         $message     = '';
     777                                        $message = '';
    768778                                }
    769779
  • trunk/src/bp-core/bp-core-template.php

    r13441 r13443  
    32053205
    32063206                // If on the user profile's landing page, just use the fullname.
    3207                 if ( bp_is_current_component( $bp->default_component ) && ( bp_get_requested_url() === bp_displayed_user_domain() ) ) {
     3207                if ( bp_is_current_component( $bp->default_component ) && ( bp_get_requested_url() === bp_displayed_user_url() ) ) {
    32083208                        $bp_title_parts[] = $displayed_user_name;
    32093209
  • trunk/src/bp-core/deprecated/1.2.php

    r13108 r13443  
    5353}
    5454
    55 
     55/**
     56 * Output the member activity feed link.
     57 *
     58 * @since 1.0.0
     59 * @deprecated 1.2.0
     60 */
     61function bp_activities_member_rss_link() {
     62        _deprecated_function( __FUNCTION__, '1.2', 'bp_member_activity_feed_link()' );
     63        bp_member_activity_feed_link();
     64}
  • 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}
  • trunk/src/bp-friends/bp-friends-template.php

    r13441 r13443  
    8989                        &nbsp;
    9090                        <span>
    91                                 <a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() ) ?>">
     91                                <a href="<?php bp_displayed_user_link( array( bp_get_friends_slug() ) ); ?>">
    9292                                        <?php esc_html_e( 'See All', 'buddypress' ) ?>
    9393                                </a>
    … …  
    203203 */
    204204function bp_friend_search_form() {
    205 
    206         $action = bp_displayed_user_domain() . bp_get_friends_slug() . '/my-friends/search/';
    207         $label  = __( 'Filter Friends', 'buddypress' ); ?>
    208 
    209                 <form action="<?php echo $action ?>" id="friend-search-form" method="post">
    210 
    211                         <label for="friend-search-box" id="friend-search-label"><?php echo $label ?></label>
    212                         <input type="search" name="friend-search-box" id="friend-search-box" value="<?php echo $value ?>"<?php echo $disabled ?> />
     205        $label        = __( 'Filter Friends', 'buddypress' );
     206        $friends_slug = bp_get_friends_slug();
     207        $action       = bp_displayed_user_url(
     208                array(
     209                        'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ),
     210                        'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_my_friends', 'my-friends' ),
     211                        'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_search', 'search' ) ),
     212                )
     213        );
     214        ?>
     215
     216                <form action="<?php echo esc_url( $action ) ?>" id="friend-search-form" method="post">
     217
     218                        <label for="friend-search-box" id="friend-search-label"><?php echo esc_html( $label ); ?></label>
     219                        <input type="search" name="friend-search-box" id="friend-search-box" value="" />
    213220
    214221                        <?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
  • trunk/src/bp-friends/classes/class-bp-core-friends-widget.php

    r13395 r13443  
    6868
    6969                $user_id           = bp_displayed_user_id();
    70                 $link              = trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() );
     70                $friends_slug      = bp_get_friends_slug();
     71                $link              = bp_displayed_user_url(
     72                        array(
     73                                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ),
     74                        )
     75                );
    7176                $instance['title'] = sprintf( __( "%s's Friends", 'buddypress' ), bp_get_displayed_user_fullname() );
    7277
  • 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 *
  • trunk/src/bp-groups/screens/user/invites.php

    r13273 r13443  
    4242                        $redirect_to = urldecode( $_GET['redirect_to'] );
    4343                } else {
    44                         $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_groups_slug() . '/' . bp_current_action() );
     44                        $path_chunks = bp_members_get_path_chunks( array( bp_get_groups_slug(), bp_current_action() ) );
     45                        $redirect_to = bp_displayed_user_url( $path_chunks );
    4546                }
    4647
    … …  
    6162                        $redirect_to = urldecode( $_GET['redirect_to'] );
    6263                } else {
    63                         $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_groups_slug() . '/' . bp_current_action() );
     64                        $path_chunks = bp_members_get_path_chunks( array( bp_get_groups_slug(), bp_current_action() ) );
     65                        $redirect_to = bp_displayed_user_url( $path_chunks );
    6466                }
    6567
  • trunk/src/bp-members/actions/invitations-bulk-manage.php

    r12951 r13443  
    7777        }
    7878
     79        $invite_slug       = bp_get_members_invitations_slug();
     80        $action_slug       = bp_current_action();
     81        $action_rewrite_id = str_replace( '-', '_', $action_slug );
     82
     83        $path_chunks = array(
     84                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $invite_slug, $invite_slug ),
     85                'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $invite_slug . '_' . $action_rewrite_id, $action_slug ),
     86        );
     87
    7988        // Redirect.
    80         bp_core_redirect( bp_displayed_user_domain() . bp_get_members_invitations_slug() . '/' . bp_current_action() . '/' );
     89        bp_core_redirect( bp_displayed_user_url( $path_chunks ) );
    8190}
    8291add_action( 'bp_actions', 'bp_members_invitations_action_bulk_manage' );
  • trunk/src/bp-members/bp-members-adminbar.php

    r13441 r13443  
    8383
    8484        // Only show if viewing a user.
    85         if ( !bp_is_user() )
     85        if ( ! bp_is_user() ) {
    8686                return false;
     87        }
    8788
    8889        // Don't show this menu to non site admins or if you're viewing your own profile.
    89         if ( !current_user_can( 'edit_users' ) || bp_is_my_profile() )
     90        if ( ! current_user_can( 'edit_users' ) || bp_is_my_profile() ) {
    9091                return false;
     92        }
    9193
    9294        $bp = buddypress();
    … …  
    9698
    9799        // Add the top-level User Admin button.
    98         $wp_admin_bar->add_node( array(
    99                 'id'    => $bp->user_admin_menu_id,
    100                 'title' => __( 'Edit Member', 'buddypress' ),
    101                 'href'  => bp_displayed_user_domain()
    102         ) );
     100        $wp_admin_bar->add_node(
     101                array(
     102                        'id'    => $bp->user_admin_menu_id,
     103                        'title' => __( 'Edit Member', 'buddypress' ),
     104                        'href'  => bp_displayed_user_url()
     105                )
     106        );
    103107
    104108        if ( bp_is_active( 'xprofile' ) ) {
    105109                // User Admin > Edit this user's profile.
    106                 $wp_admin_bar->add_node( array(
    107                         'parent' => $bp->user_admin_menu_id,
    108                         'id'     => $bp->user_admin_menu_id . '-edit-profile',
    109                         'title'  => __( "Edit Profile", 'buddypress' ),
    110                         'href'   => bp_get_members_component_link( $bp->profile->id, 'edit' )
    111                 ) );
     110                $wp_admin_bar->add_node(
     111                        array(
     112                                'parent' => $bp->user_admin_menu_id,
     113                                'id'     => $bp->user_admin_menu_id . '-edit-profile',
     114                                'title'  => __( "Edit Profile", 'buddypress' ),
     115                                'href'   => bp_get_members_component_link( $bp->profile->id, 'edit' ),
     116                        )
     117                );
    112118
    113119                // User Admin > Edit this user's avatar.
    114120                if ( buddypress()->avatar->show_avatars ) {
    115                         $wp_admin_bar->add_node( array(
    116                                 'parent' => $bp->user_admin_menu_id,
    117                                 'id'     => $bp->user_admin_menu_id . '-change-avatar',
    118                                 'title'  => __( "Edit Profile Photo", 'buddypress' ),
    119                                 'href'   => bp_get_members_component_link( $bp->profile->id, 'change-avatar' )
    120                         ) );
     121                        $wp_admin_bar->add_node(
     122                                array(
     123                                        'parent' => $bp->user_admin_menu_id,
     124                                        'id'     => $bp->user_admin_menu_id . '-change-avatar',
     125                                        'title'  => __( "Edit Profile Photo", 'buddypress' ),
     126                                        'href'   => bp_get_members_component_link( $bp->profile->id, 'change-avatar' ),
     127                                )
     128                        );
    121129                }
    122130
    123131                // User Admin > Edit this user's cover image.
    124132                if ( bp_displayed_user_use_cover_image_header() ) {
    125                         $wp_admin_bar->add_node( array(
    126                                 'parent' => $bp->user_admin_menu_id,
    127                                 'id'     => $bp->user_admin_menu_id . '-change-cover-image',
    128                                 'title'  => __( 'Edit Cover Image', 'buddypress' ),
    129                                 'href'   => bp_get_members_component_link( $bp->profile->id, 'change-cover-image' )
    130                         ) );
     133                        $wp_admin_bar->add_node(
     134                                array(
     135                                        'parent' => $bp->user_admin_menu_id,
     136                                        'id'     => $bp->user_admin_menu_id . '-change-cover-image',
     137                                        'title'  => __( 'Edit Cover Image', 'buddypress' ),
     138                                        'href'   => bp_get_members_component_link( $bp->profile->id, 'change-cover-image' ),
     139                                )
     140                        );
    131141                }
    132142
    … …  
    135145        if ( bp_is_active( 'settings' ) ) {
    136146                // User Admin > Spam/unspam.
    137                 $wp_admin_bar->add_node( array(
    138                         'parent' => $bp->user_admin_menu_id,
    139                         'id'     => $bp->user_admin_menu_id . '-user-capabilities',
    140                         'title'  => __( 'User Capabilities', 'buddypress' ),
    141                         'href'   => bp_displayed_user_domain() . 'settings/capabilities/'
    142                 ) );
     147                $wp_admin_bar->add_node(
     148                        array(
     149                                'parent' => $bp->user_admin_menu_id,
     150                                'id'     => $bp->user_admin_menu_id . '-user-capabilities',
     151                                'title'  => __( 'User Capabilities', 'buddypress' ),
     152                                'href'   => bp_get_members_component_link( $bp->settings->id, 'capabilities' ),
     153                        )
     154                );
    143155
    144156                // User Admin > Delete Account.
    145                 $wp_admin_bar->add_node( array(
    146                         'parent' => $bp->user_admin_menu_id,
    147                         'id'     => $bp->user_admin_menu_id . '-delete-user',
    148                         'title'  => __( 'Delete Account', 'buddypress' ),
    149                         'href'   => bp_displayed_user_domain() . 'settings/delete-account/'
    150                 ) );
    151 
    152         }
    153 
     157                $wp_admin_bar->add_node(
     158                        array(
     159                                'parent' => $bp->user_admin_menu_id,
     160                                'id'     => $bp->user_admin_menu_id . '-delete-user',
     161                                'title'  => __( 'Delete Account', 'buddypress' ),
     162                                'href'   => bp_get_members_component_link( $bp->settings->id, 'delete-account' ),
     163                        )
     164                );
     165        }
    154166}
    155167add_action( 'admin_bar_menu', 'bp_members_admin_bar_user_admin_menu', 99 );
  • trunk/src/bp-members/bp-members-functions.php

    r13436 r13443  
    137137         */
    138138        return apply_filters( 'bp_core_get_users', $retval, $r );
     139}
     140
     141/**
     142 * Get members path chunks using an array of URL slugs.
     143 *
     144 * @since 12.0.0
     145 *
     146 * @param array $chunks An array of URL slugs.
     147 * @return array An array of BP Rewrites URL arguments.
     148 */
     149function bp_members_get_path_chunks( $chunks = array() ) {
     150        $path_chunks = array();
     151
     152        $single_item_component            = array_shift( $chunks );
     153        $item_component_rewrite_id_suffix = '';
     154        if ( $single_item_component ) {
     155                $item_component_rewrite_id_suffix     = str_replace( '-', '_', $single_item_component );
     156                $path_chunks['single_item_component'] = bp_rewrites_get_slug( 'members', 'member_' . $item_component_rewrite_id_suffix, $single_item_component );
     157        }
     158
     159        $single_item_action            = array_shift( $chunks );
     160        $item_action_rewrite_id_suffix = '';
     161        if ( $single_item_action ) {
     162                $item_action_rewrite_id_suffix     = str_replace( '-', '_', $single_item_action );
     163                $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $item_component_rewrite_id_suffix . '_' . $item_action_rewrite_id_suffix, $single_item_action );
     164        }
     165
     166        if ( $chunks && $item_component_rewrite_id_suffix && $item_component_rewrite_id_suffix ) {
     167                foreach ( $chunks as $chunk ) {
     168                        $item_action_variable_rewrite_id_suffix        =  str_replace( '-', '_', $chunk );
     169                        $path_chunks['single_item_action_variables'][] = bp_rewrites_get_slug( 'members', 'member_' . $item_component_rewrite_id_suffix . '_' . $item_action_rewrite_id_suffix . '_' . $item_action_variable_rewrite_id_suffix, $chunk );
     170                }
     171        }
     172
     173        return $path_chunks;
    139174}
    140175
  • trunk/src/bp-members/bp-members-template.php

    r13442 r13443  
    18761876 *
    18771877 * @since 1.2.4
    1878  */
    1879 function bp_displayed_user_link() {
    1880         echo esc_url( bp_displayed_user_url() );
     1878 * @since 12.0.0 Introduced the `$chunk` argument.
     1879 *
     1880 * @param array $chunk A list of slugs to append to the URL.
     1881 */
     1882function bp_displayed_user_link( $chunks = array() ) {
     1883        $path_chunks = array();
     1884        $chunks      = (array) $chunks;
     1885
     1886        if ( $chunks ) {
     1887                $path_chunks = bp_members_get_path_chunks( $chunks );
     1888        }
     1889
     1890        echo esc_url( bp_displayed_user_url( $path_chunks ) );
    18811891}
    18821892
    … …  
    19621972
    19631973        if ( $chunks ) {
    1964                 $single_item_component = array_shift( $chunks );
    1965                 if ( $single_item_component ) {
    1966                         $path_chunks['single_item_component'] = bp_rewrites_get_slug( 'members', 'member_' . $single_item_component, $single_item_component );
    1967                 }
    1968 
    1969                 $single_item_action = array_shift( $chunks );
    1970                 if ( $single_item_action ) {
    1971                         $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $single_item_component . '_' . $single_item_action, $single_item_action );
    1972                 }
    1973 
    1974                 if ( $chunks ) {
    1975                         foreach ( $chunks as $chunk ) {
    1976                                 $path_chunks['single_item_action_variables'][] = bp_rewrites_get_slug( 'members', 'member_' . $single_item_component . '_' . $single_item_action . '_' . $chunk, $chunk );
    1977                         }
    1978                 }
     1974                $path_chunks = bp_members_get_path_chunks( $chunks );
    19791975        }
    19801976
    … …  
    30983094                }
    30993095
     3096                $path_chunks = array(
     3097                        'single_item_component' => $bp->{$component}->slug,
     3098                );
     3099
    31003100                // Append $action to $url if there is no $type.
    31013101                if ( ! empty( $action ) ) {
    3102                         $url = bp_displayed_user_domain() . $bp->{$component}->slug . '/' . $action;
    3103                 } else {
    3104                         $url = bp_displayed_user_domain() . $bp->{$component}->slug;
     3102                        $action_rewrite_id                 = 'member_' . str_replace( '-', '_', $action );
     3103                        $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', $action_rewrite_id, $action );
    31053104                }
    31063105
    31073106                // Add a slash at the end of our user url.
    3108                 $url = trailingslashit( $url );
     3107                $url = bp_displayed_user_url( $path_chunks );
    31093108
    31103109                // Add possible query arg.
    … …  
    31453144         */
    31463145        function bp_get_avatar_delete_link() {
     3146                $profile_slug = bp_get_profile_slug();
     3147                $url          = wp_nonce_url(
     3148                        bp_displayed_user_url(
     3149                                array(
     3150                                        'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ),
     3151                                        'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_change_avatar', 'change-avatar' ),
     3152                                        'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_delete_avatar', 'delete-avatar' ) ),
     3153                                )
     3154                        ),
     3155                        'bp_delete_avatar_link'
     3156                );
    31473157
    31483158                /**
    … …  
    31513161                 * @since 1.1.0
    31523162                 *
    3153                  * @param string $value Nonced URL used for deleting an avatar.
    3154                  */
    3155                 return apply_filters( 'bp_get_avatar_delete_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_profile_slug() . '/change-avatar/delete-avatar/', 'bp_delete_avatar_link' ) );
     3163                 * @param string $url Nonced URL used for deleting an avatar.
     3164                 */
     3165                return apply_filters( 'bp_get_avatar_delete_link', $url );
    31563166        }
    31573167
  • trunk/src/bp-members/classes/class-bp-members-component.php

    r13442 r13443  
    384384
    385385                if ( bp_displayed_user_id() ) {
    386                         $bp->canonical_stack['base_url'] = bp_displayed_user_domain();
     386                        $bp->canonical_stack['base_url'] = bp_displayed_user_url();
    387387
    388388                        if ( bp_current_component() ) {
  • trunk/src/bp-members/screens/change-avatar.php

    r13220 r13443  
    8686
    8787                        bp_core_add_message( __( 'Your new profile photo was uploaded successfully.', 'buddypress' ) );
    88                         bp_core_redirect( bp_displayed_user_domain() );
     88                        bp_core_redirect( bp_displayed_user_url() );
    8989                }
    9090        }
  • trunk/src/bp-messages/actions/bulk-delete.php

    r13096 r13443  
    1919        }
    2020
    21         $thread_ids = $_POST['thread_ids'];
     21        $thread_ids  = $_POST['thread_ids'];
     22        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action() ) );
     23        $redirect    = bp_displayed_user_url( $path_chunks );
    2224
    2325        if ( ! $thread_ids || ! messages_check_thread_access( $thread_ids ) ) {
    24                 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
     26                bp_core_redirect( $redirect );
    2527        } else {
    2628                if ( ! check_admin_referer( 'messages_delete_thread' ) ) {
    … …  
    3436                }
    3537
    36                 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
     38                bp_core_redirect( $redirect );
    3739        }
    3840}
  • trunk/src/bp-messages/actions/bulk-manage-star.php

    r13096 r13443  
    7373        }
    7474
     75        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action() ) );
     76        $redirect    = bp_displayed_user_url( $path_chunks );
     77
    7578        // Redirect back to message box.
    76         bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
     79        bp_core_redirect( $redirect );
    7780        die();
    7881}
  • trunk/src/bp-messages/actions/bulk-manage.php

    r13096 r13443  
    2222        }
    2323
    24         $action   = ! empty( $_POST['messages_bulk_action'] ) ? $_POST['messages_bulk_action'] : '';
    25         $nonce    = ! empty( $_POST['messages_bulk_nonce'] ) ? $_POST['messages_bulk_nonce'] : '';
    26         $messages = ! empty( $_POST['message_ids'] ) ? $_POST['message_ids'] : '';
    27         $messages = wp_parse_id_list( $messages );
     24        $action      = ! empty( $_POST['messages_bulk_action'] ) ? $_POST['messages_bulk_action'] : '';
     25        $nonce       = ! empty( $_POST['messages_bulk_nonce'] ) ? $_POST['messages_bulk_nonce'] : '';
     26        $messages    = ! empty( $_POST['message_ids'] ) ? $_POST['message_ids'] : '';
     27        $messages    = wp_parse_id_list( $messages );
     28        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action() ) );
     29        $redirect    = bp_displayed_user_url( $path_chunks );
    2830
    2931        // Bail if no action or no IDs.
    3032        if ( ( ! in_array( $action, array( 'delete', 'read', 'unread' ), true ) ) || empty( $messages ) || empty( $nonce ) ) {
    31                 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
     33                bp_core_redirect( $redirect );
    3234        }
    3335
    … …  
    4143                if ( ! messages_check_thread_access( $message ) && ! bp_current_user_can( 'bp_moderate' ) ) {
    4244                        bp_core_add_message( __( 'There was a problem managing your messages.', 'buddypress' ), 'error' );
    43                         bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
     45                        bp_core_redirect( $redirect );
    4446                }
    4547        }
    … …  
    7072
    7173        // Redirect back to message box.
    72         bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' );
     74        bp_core_redirect( $redirect );
    7375}
    7476add_action( 'bp_actions', 'bp_messages_action_bulk_manage' );
  • trunk/src/bp-messages/actions/delete.php

    r13096 r13443  
    1919        }
    2020
    21         $thread_id = bp_action_variable( 1 );
     21        $thread_id   = bp_action_variable( 1 );
     22        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action() ) );
     23        $redirect    = bp_displayed_user_url( $path_chunks );
    2224
    2325        if ( ! $thread_id || ! is_numeric( $thread_id ) || ! messages_check_thread_access( $thread_id ) ) {
    24                 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
     26                bp_core_redirect( $redirect );
    2527        } else {
    2628                if ( ! check_admin_referer( 'messages_delete_thread' ) ) {
    … …  
    3436                        bp_core_add_message( __('Message deleted.', 'buddypress') );
    3537                }
    36                 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
     38                bp_core_redirect( $redirect );
    3739        }
    3840}
  • trunk/src/bp-messages/actions/exit.php

    r13196 r13443  
    1919        }
    2020
    21         $thread_id = bp_action_variable( 1 );
     21        $thread_id   = bp_action_variable( 1 );
     22        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action() ) );
     23        $redirect    = bp_displayed_user_url( $path_chunks );
    2224
    2325        if ( ! $thread_id || ! is_numeric( $thread_id ) || ! messages_check_thread_access( $thread_id ) ) {
    24                 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
     26                bp_core_redirect( $redirect );
    2527        } else {
    2628                if ( ! check_admin_referer( 'bp_messages_exit_thread' ) ) {
    … …  
    3537                }
    3638
    37                 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
     39                bp_core_redirect( $redirect );
    3840        }
    3941}
  • trunk/src/bp-messages/actions/read.php

    r13096 r13443  
    4444        }
    4545
     46        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action() ) );
     47        $redirect    = bp_displayed_user_url( $path_chunks );
     48
    4649        // Redirect back to the message box.
    47         bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() );
     50        bp_core_redirect( $redirect );
    4851}
    4952add_action( 'bp_actions', 'bp_messages_action_mark_read' );
  • trunk/src/bp-messages/actions/star.php

    r13096 r13443  
    3939
    4040        // Redirect back to previous screen.
    41         $redirect = wp_get_referer() ? wp_get_referer() : bp_displayed_user_domain() . bp_get_messages_slug();
     41        $redirect = wp_get_referer();
     42
     43        if ( ! $redirect ) {
     44                $messages_slug = bp_get_messages_slug();
     45                $redirect      = bp_displayed_user_url(
     46                        array(
     47                                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $messages_slug, $messages_slug ),
     48                        )
     49                );
     50        }
     51
    4252        bp_core_redirect( $redirect );
    4353        die();
  • trunk/src/bp-messages/actions/unread.php

    r13096 r13443  
    4444        }
    4545
     46        $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action() ) );
     47        $redirect    = bp_displayed_user_url( $path_chunks );
     48
    4649        // Redirect back to the message box URL.
    47         bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() );
     50        bp_core_redirect( $redirect );
    4851}
    4952add_action( 'bp_actions', 'bp_messages_action_mark_unread' );
  • trunk/src/bp-messages/actions/view.php

    r13383 r13443  
    4646                }
    4747
    48                 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id . '/' );
     48                $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), 'view', $thread_id ) );
     49                $redirect    = bp_displayed_user_url( $path_chunks );
     50
     51                bp_core_redirect( $redirect );
    4952        }
    5053
  • trunk/src/bp-messages/bp-messages-template.php

    r13442 r13443  
    973973         */
    974974        function bp_get_messages_form_action() {
     975                $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), bp_current_action(), bp_action_variable( 0 ) ) );
     976                $url         = bp_displayed_user_url( $path_chunks );
    975977
    976978                /**
    … …  
    979981                 * @since 1.0.0
    980982                 *
    981                  * @param string $value The form action.
    982                  */
    983                 return apply_filters( 'bp_get_messages_form_action', trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' . bp_action_variable( 0 ) ) );
     983                 * @param string $url The form action.
     984                 */
     985                return apply_filters( 'bp_get_messages_form_action',$url );
    984986        }
    985987
    … …  
    22992301         */
    23002302        function bp_get_the_thread_delete_link() {
     2303                $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), 'inbox', 'delete', bp_get_the_thread_id() ) );
     2304                $url         = wp_nonce_url( bp_displayed_user_url( $path_chunks ), 'messages_delete_thread' );
    23012305
    23022306                /**
    … …  
    23052309                 * @since 1.0.0
    23062310                 *
    2307                  * @param string $value URL for deleting the current thread.
    2308                  * @param string $value Text indicating action being executed.
    2309                  */
    2310                 return apply_filters( 'bp_get_message_thread_delete_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_messages_slug() . '/inbox/delete/' . bp_get_the_thread_id(), 'messages_delete_thread' ) );
     2311                 * @param string $url URL for deleting the current thread.
     2312                 */
     2313                return apply_filters( 'bp_get_message_thread_delete_link', $url );
    23112314        }
    23122315
    … …  
    23272330         */
    23282331        function bp_get_the_thread_exit_link() {
     2332                $path_chunks = bp_members_get_path_chunks( array( bp_get_messages_slug(), 'inbox', 'exit', bp_get_the_thread_id() ) );
     2333                $url         = wp_nonce_url( bp_displayed_user_url( $path_chunks ), 'bp_messages_exit_thread' );
    23292334
    23302335                /**
    23312336                 * Filters the URL to exit the current thread.
    23322337                 *
    2333                  * @since 1.0.0
    2334                  *
    2335                  * @param string $value URL to exit the current thread.
    2336                  * @param string $value Text indicating action being executed.
    2337                  */
    2338                 return apply_filters( 'bp_get_the_thread_exit_link', wp_nonce_url( bp_displayed_user_domain() . bp_get_messages_slug() . '/inbox/exit/' . bp_get_the_thread_id(), 'bp_messages_exit_thread' ) );
     2338                 * @since 10.0.0
     2339                 *
     2340                 * @param string $url URL to exit the current thread.
     2341                 */
     2342                return apply_filters( 'bp_get_the_thread_exit_link', $url );
    23392343        }
    23402344
  • trunk/src/bp-settings/actions/capabilities.php

    r13090 r13443  
    7878        do_action( 'bp_settings_capabilities_after_save' );
    7979
    80         // Redirect to the root domain.
    81         bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/capabilities/' );
     80        $path_chunks = bp_members_get_path_chunks( array( bp_get_settings_slug(), 'capabilities' ) );
     81        $redirect    = bp_displayed_user_url( $path_chunks );
     82
     83        // Redirect to the settings capability page.
     84        bp_core_redirect( $redirect );
    8285}
    8386add_action( 'bp_actions', 'bp_settings_action_capabilities' );
  • trunk/src/bp-settings/actions/general.php

    r13395 r13443  
    5151        $feedback      = array();                // array of strings for feedback.
    5252        $user_id       = bp_displayed_user_id(); // The ID of the user being displayed.
     53        $settings_slug = bp_get_settings_slug();
     54        $path_chunks   = array(
     55                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug ),
     56        );
    5357
    5458        // Nonce check.
    … …  
    100104
    101105                                        bp_update_user_meta( $user_id, 'pending_email_change', $pending_email );
    102                                         $verify_link = bp_displayed_user_domain() . bp_get_settings_slug() . '/?verify_email_change=' . $hash;
     106                                        $verify_link = add_query_arg(
     107                                                'verify_email_change',
     108                                                $hash,
     109                                                bp_displayed_user_url( $path_chunks )
     110                                        );
    103111
    104112                                        // Send the verification email.
    … …  
    227235
    228236        // Set the URL to redirect the user to.
    229         $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_settings_slug() . '/general' );
     237        $path_chunks['single_item_action'] = bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_general', 'general' );
     238        $redirect_to = bp_displayed_user_url( $path_chunks );
    230239
    231240        /**
    … …  
    262271        }
    263272
    264         $redirect_to = trailingslashit( bp_displayed_user_domain() . bp_get_settings_slug() );
     273        $settings_slug = bp_get_settings_slug();
     274        $path_chunks   = array(
     275                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug )
     276        );
     277        $redirect_to = bp_displayed_user_url( $path_chunks );
    265278
    266279        // Email change is being verified.
  • trunk/src/bp-settings/actions/notifications.php

    r13090 r13443  
    5454        do_action( 'bp_core_notification_settings_after_save' );
    5555
    56         bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/notifications/' );
     56        $settings_slug = bp_get_settings_slug();
     57        $path_chunks   = array(
     58                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug ),
     59                'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_notifications', 'notifications' ),
     60        );
     61
     62        bp_core_redirect( bp_displayed_user_url( $path_chunks ) );
    5763}
    5864add_action( 'bp_actions', 'bp_settings_action_notifications' );
  • trunk/src/bp-settings/bp-settings-template.php

    r13090 r13443  
    8181        }
    8282
     83        $settings_slug = bp_get_settings_slug();
     84        $dismiss_url   = wp_nonce_url(
     85                add_query_arg(
     86                        'dismiss_email_change',
     87                        1,
     88                        bp_displayed_user_url(
     89                                array(
     90                                        'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug ),
     91                                )
     92                        )
     93                ),
     94                'bp_dismiss_email_change'
     95        );
    8396        ?>
    8497
    … …  
    98111                                __( 'Check your email (%1$s) for the verification link, or <a href="%2$s">cancel the pending change</a>.', 'buddypress' ),
    99112                                '<code>' . esc_html( $pending_email['newemail'] ) . '</code>',
    100                                 esc_url( wp_nonce_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/?dismiss_email_change=1', 'bp_dismiss_email_change' ) )
     113                                esc_url( $dismiss_url )
    101114                        );
    102115                        ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php

    r12082 r13443  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 3.0.0
     7 * @version 12.0.0
    88 */
    99
    … …  
    5252        do_action( 'bp_before_member_messages_threads' ); ?>
    5353
    54         <form action="<?php echo bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ?>/bulk-manage/" method="post" id="messages-bulk-management">
     54        <form action="<?php bp_displayed_user_link( array( bp_get_messages_slug(), bp_current_action(), 'bulk-manage' ) ); ?>" method="post" id="messages-bulk-management">
    5555
    5656                <table id="message-threads" class="messages-notices">
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/capabilities.php

    r12082 r13443  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 3.0.0
     7 * @version 12.0.0
    88 */
    99
    … …  
    1111do_action( 'bp_before_member_settings_template' ); ?>
    1212
    13 <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/capabilities/'; ?>" name="account-capabilities-form" id="account-capabilities-form" class="standard-form" method="post">
     13<form action="<?php bp_displayed_user_link( array( bp_get_settings_slug(), 'capabilities' ) ); ?>" name="account-capabilities-form" id="account-capabilities-form" class="standard-form" method="post">
    1414
    1515        <?php
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/data.php

    r13327 r13443  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 11.0.0
     7 * @version 12.0.0
    88 */
    99
    … …  
    8585                                sprintf(
    8686                                        '<a href="%1$s">%2$s</a>',
    87                                         esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/delete-account/' ),
     87                                        esc_url( bp_displayed_user_url( array( bp_get_settings_slug(), 'delete-account' ) ) ),
    8888                                        esc_html__( 'Delete Account', 'buddypress' )
    8989                                )
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/delete-account.php

    r12082 r13443  
    2525</div>
    2626
    27 <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/delete-account'; ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post">
     27<form action="<?php bp_displayed_user_link( array( bp_get_settings_slug(), 'delete-account' ) ); ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post">
    2828
    2929        <?php
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/general.php

    r12082 r13443  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 3.0.0
     7 * @version 12.0.0
    88 */
    99
    … …  
    1616?></h2>
    1717
    18 <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/general'; ?>" method="post" class="standard-form" id="settings-form">
     18<form action="<?php bp_displayed_user_link( array( bp_get_settings_slug(), 'general' ) ); ?>" method="post" class="standard-form" id="settings-form">
    1919
    20         <?php if ( !is_super_admin() ) : ?>
     20        <?php if ( ! is_super_admin() ) : ?>
    2121
    2222                <label for="pwd"><?php _e( 'Current Password <span>(required to update email or change current password)</span>', 'buddypress' ); ?></label>
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/notifications.php

    r12082 r13443  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 3.0.0
     7 * @version 12.0.0
    88 */
    99
    … …  
    1616?></h2>
    1717
    18 <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/notifications'; ?>" method="post" class="standard-form" id="settings-form">
     18<form action="<?php bp_displayed_user_link( array( bp_get_settings_slug(), 'notifications' ) ); ?>" method="post" class="standard-form" id="settings-form">
    1919        <p><?php _e( 'Send an email notice when:', 'buddypress' ); ?></p>
    2020
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/profile.php

    r12082 r13443  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 3.0.0
     7 * @version 12.0.0
    88 */
    99
    … …  
    2020?></h2>
    2121
    22 <form action="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_settings_slug() . '/profile' ); ?>" method="post" class="standard-form" id="settings-form">
     22<form action="<?php bp_displayed_user_link( array( bp_get_settings_slug(), 'profile' ) ); ?>" method="post" class="standard-form" id="settings-form">
    2323
    2424        <?php if ( bp_xprofile_get_settings_fields() ) : ?>
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/capabilities.php

    r12908 r13443  
    44 *
    55 * @since 3.0.0
    6  * @version 8.0.0
     6 * @version 12.0.0
    77 */
    88
    … …  
    1313</h2>
    1414
    15 <form action="<?php echo esc_url( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'settings' ) . '/capabilities/' ); ?>" name="account-capabilities-form" id="account-capabilities-form" class="standard-form" method="post">
     15<form action="<?php bp_displayed_user_link( array( bp_nouveau_get_component_slug( 'settings' ), 'capabilities' ) ); ?>" name="account-capabilities-form" id="account-capabilities-form" class="standard-form" method="post">
    1616
    1717        <label for="user-spammer">
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/data.php

    r13327 r13443  
    44 *
    55 * @since 3.1.0
    6  * @version 11.0.0
     6 * @version 12.0.0
    77 */
    88
    … …  
    7878                                sprintf(
    7979                                        '<a href="%1$s">%2$s</a>',
    80                                         esc_url( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'settings' ) . '/delete-account/' ),
     80                                        esc_url( bp_displayed_user_url( array( bp_nouveau_get_component_slug( 'settings' ), 'delete-account' ) ) ),
    8181                                        esc_html__( 'Delete Account', 'buddypress' )
    8282                                )
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/delete-account.php

    r12908 r13443  
    44 *
    55 * @since 3.0.0
    6  * @version 8.0.0
     6 * @version 12.0.0
    77 */
    88
    … …  
    1515<?php bp_nouveau_user_feedback( 'member-delete-account' ); ?>
    1616
    17 <form action="<?php echo esc_url( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'settings' ) . '/delete-account' ); ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post">
     17<form action="<?php bp_displayed_user_link( array( bp_nouveau_get_component_slug( 'settings' ), 'delete-account' ) ); ?>" name="account-delete-form" id="account-delete-form" class="standard-form" method="post">
    1818
    1919        <label id="delete-account-understand" class="warn" for="delete-account-understand">
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/general.php

    r12908 r13443  
    44 *
    55 * @since 3.0.0
    6  * @version 8.0.0
     6 * @version 12.0.0
    77 */
    88
    … …  
    1717</p>
    1818
    19 <form action="<?php echo esc_url( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'settings' ) . '/general' ); ?>" method="post" class="standard-form" id="your-profile">
     19<form action="<?php bp_displayed_user_link( array( bp_nouveau_get_component_slug( 'settings' ), 'general' ) ); ?>" method="post" class="standard-form" id="your-profile">
    2020
    2121        <?php if ( ! is_super_admin() ) : ?>
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/group-invites.php

    r12908 r13443  
    44 *
    55 * @since 3.0.0
    6  * @version 8.0.0
     6 * @version 12.0.0
    77 */
    88?>
    … …  
    2121
    2222
    23 <form action="<?php echo esc_url( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'settings' ) . '/invites/' ); ?>" name="account-group-invites-form" id="account-group-invites-form" class="standard-form" method="post">
     23<form action="<?php bp_displayed_user_link( array( bp_nouveau_get_component_slug( 'settings' ), 'invites' ) ); ?>" name="account-group-invites-form" id="account-group-invites-form" class="standard-form" method="post">
    2424
    2525        <label for="account-group-invites-preferences">
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/notifications.php

    r12908 r13443  
    44 *
    55 * @since 3.0.0
    6  * @version 3.0.0
     6 * @version 12.0.0
    77 */
    88
    … …  
    1717</p>
    1818
    19 <form action="<?php echo esc_url( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'settings' ) . '/notifications' ); ?>" method="post" class="standard-form" id="settings-form">
     19<form action="<?php bp_displayed_user_link( array( bp_nouveau_get_component_slug( 'settings' ), 'notifications' ) ); ?>" method="post" class="standard-form" id="settings-form">
    2020
    2121        <?php bp_nouveau_member_email_notice_settings(); ?>
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/profile.php

    r12908 r13443  
    1717</p>
    1818
    19 <form action="<?php echo esc_url( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'settings' ) . '/profile/' ); ?>" method="post" class="standard-form" id="settings-form">
     19<form action="<?php bp_displayed_user_link( array( bp_nouveau_get_component_slug( 'settings' ), 'profile' ) ); ?>" method="post" class="standard-form" id="settings-form">
    2020
    2121        <?php if ( bp_xprofile_get_settings_fields() ) : ?>
  • trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php

    r13442 r13443  
    503503                }
    504504
    505                 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'settings' ) ) . 'invites/' );
     505                bp_core_redirect( bp_displayed_user_url( array( bp_nouveau_get_component_slug( 'settings' ), 'invites' ) ) );
    506506        }
    507507
  • trunk/src/bp-templates/bp-nouveau/includes/template-tags.php

    r13441 r13443  
    22592259
    22602260        if ( bp_is_user() ) {
    2261                 $url = rawurlencode( bp_displayed_user_domain() );
     2261                $url = rawurlencode( bp_displayed_user_url() );
    22622262
    22632263        } elseif ( bp_is_group() ) {
    … …  
    26992699
    27002700                                if ( $retval ) {
    2701                                         $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/feed' );
     2701                                        $bp_nouveau->activity->current_rss_feed['link'] = bp_displayed_user_url( array( bp_nouveau_get_component_slug( 'activity' ), 'feed' ) );
    27022702                                }
    27032703
    … …  
    27062706
    27072707                                        if ( $retval ) {
    2708                                                 $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/' . bp_nouveau_get_component_slug( 'friends' ) . '/feed' );
     2708                                                $bp_nouveau->activity->current_rss_feed['link'] = bp_displayed_user_url( array( bp_nouveau_get_component_slug( 'activity' ), bp_nouveau_get_component_slug( 'friends' ), 'feed' ) );
    27092709                                        }
    27102710                                } elseif ( bp_is_active( 'groups' ) && bp_is_current_action( bp_nouveau_get_component_slug( 'groups' ) ) ) {
    … …  
    27122712
    27132713                                        if ( $retval ) {
    2714                                                 $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/' . bp_nouveau_get_component_slug( 'groups' ) . '/feed' );
     2714                                                $bp_nouveau->activity->current_rss_feed['link'] = bp_displayed_user_url( array( bp_nouveau_get_component_slug( 'activity' ), bp_nouveau_get_component_slug( 'groups' ), 'feed' ) );
    27152715                                        }
    27162716                                } elseif ( bp_activity_do_mentions() && bp_is_current_action( 'mentions' ) ) {
    … …  
    27182718
    27192719                                        if ( $retval ) {
    2720                                                 $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/mentions/feed' );
     2720                                                $bp_nouveau->activity->current_rss_feed['link'] = bp_displayed_user_url( array( bp_nouveau_get_component_slug( 'activity' ), 'mentions', 'feed' ) );
    27212721                                        }
    27222722                                } elseif ( bp_activity_can_favorite() && bp_is_current_action( 'favorites' ) ) {
    … …  
    27242724
    27252725                                        if ( $retval ) {
    2726                                                 $bp_nouveau->activity->current_rss_feed['link'] = trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'activity' ) . '/favorites/feed' );
     2726                                                $bp_nouveau->activity->current_rss_feed['link'] = bp_displayed_user_url( array( bp_nouveau_get_component_slug( 'activity' ), 'favorites', 'feed' ) );
    27272727                                        }
    27282728                                }
  • trunk/src/bp-xprofile/bp-xprofile-template.php

    r13393 r13443  
    390390
    391391                // Build the form action URL.
    392                 $form_action = trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . $group->id );
     392                $profile_slug = bp_get_profile_slug();
     393                $path_chunks  = array(
     394                        'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ),
     395                        'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit', 'edit' ),
     396                        'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit_group', 'group' ), $group->id ),
     397                );
     398                $form_action = bp_displayed_user_url( $path_chunks );
    393399
    394400                /**
    … …  
    10741080
    10751081                // Build the profile field group link.
    1076                 $link   = trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . $groups[ $i ]->id );
     1082                $profile_slug = bp_get_profile_slug();
     1083                $path_chunks  = array(
     1084                        'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ),
     1085                        'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit', 'edit' ),
     1086                        'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit_group', 'group' ), $groups[ $i ]->id ),
     1087                );
     1088                $link         = bp_displayed_user_url( $path_chunks );
    10771089
    10781090                // Add tab to end of tabs array.
    … …  
    12321244 */
    12331245function bp_edit_profile_button() {
     1246        $profile_slug = bp_get_profile_slug();
     1247        $path_chunks  = array(
     1248                'single_item_component' => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ),
     1249                'single_item_action'    => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit', 'edit' ),
     1250        );
     1251
    12341252        bp_button( array(
    12351253                'id'                => 'edit_profile',
    … …  
    12371255                'must_be_logged_in' => true,
    12381256                'block_self'        => true,
    1239                 'link_href'         => trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit' ),
     1257                'link_href'         => bp_displayed_user_url( $path_chunks ),
    12401258                'link_class'        => 'edit',
    12411259                'link_text'         => __( 'Edit Profile', 'buddypress' ),
  • trunk/src/bp-xprofile/screens/edit.php

    r13393 r13443  
    2121        }
    2222
     23        $profile_slug = bp_get_profile_slug();
     24        $path_chunks  = array(
     25                'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug, $profile_slug ),
     26                'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit', 'edit' ),
     27        );
     28
     29
    2330        // Make sure a group is set.
    2431        if ( ! bp_action_variable( 1 ) ) {
    25                 bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/1' ) );
     32                $path_chunks['single_item_action_variables'] = array( bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit_group', 'group' ), 1 );
     33                bp_core_redirect( bp_displayed_user_url( $path_chunks ) );
    2634        }
    2735
    … …  
    4351                // Check we have field ID's.
    4452                if ( empty( $_POST['field_ids'] ) ) {
    45                         bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . bp_action_variable( 1 ) ) );
     53                        $path_chunks['single_item_action_variables'] = array( bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit_group', 'group' ), bp_action_variable( 1 ) );
     54                        bp_core_redirect( bp_displayed_user_url( $path_chunks ) );
    4655                }
    4756
    … …  
    156165
    157166                        // Redirect back to the edit screen to display the updates and message.
    158                         bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . bp_action_variable( 1 ) ) );
     167                        $path_chunks['single_item_action_variables'] = array( bp_rewrites_get_slug( 'members', 'member_' . $profile_slug . '_edit_group', 'group' ), bp_action_variable( 1 ) );
     168                        bp_core_redirect( bp_displayed_user_url( $path_chunks ) );
    159169                }
    160170        }
  • trunk/src/bp-xprofile/screens/settings-profile.php

    r13393 r13443  
    111111
    112112        // Redirect to the root domain.
    113         bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/profile' );
     113        $settings_slug = bp_get_settings_slug();
     114        $path_chunks   = array(
     115                'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug, $settings_slug ),
     116                'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $settings_slug . '_profile', 'profile' ),
     117        );
     118        bp_core_redirect( bp_displayed_user_url( $path_chunks ) );
    114119}
    115120add_action( 'bp_actions', 'bp_xprofile_action_settings' );
Note: See TracChangeset for help on using the changeset viewer.