Skip to:
Content

BuddyPress.org

Changeset 13437


Ignore:
Timestamp:
03/18/2023 09:42:31 AM (3 years ago)
Author:
imath
Message:

BP Rewrites: start the migration process for the Groups component

  • Add rewrite tags & rules for the Groups directory type and the create URLs.
  • Introduce bp_get_group_url()/bp_group_url() & to retrieve/output a Groups single item URL using BP Rewrites.
  • Introduce bp_get_group_restricted_screens(), bp_get_group_extension_screens() & bp_get_group_screens() to get information about the Groups screens (in particular each screen rewrite ID). These functions will ease slug customizations from the BuddyPress URL settings tab.
  • Improve the Group creation process making sure it's using BP Rewrites to build URLs.
  • Perform easiest replacements for bp_get_group_permalink()/bp_group_permalink() & bp_get_groups_directory_permalink()/bp_groups_directory_permalink() in favor of bp_get_group_url()/bp_group_url() & bp_get_groups_directory_url()/bp_groups_directory_url()`.
  • Improve code formatting & properly escape single group URLs into templates.
  • Update impacted Unit Tests.

Props r-a-y, johnjamesjacoby, boonebgorges

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

Location:
trunk
Files:
45 edited

Legend:

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

    r13436 r13437  
    12281228                                if ( bp_is_active( 'groups' ) ) {
    12291229                                        $group = groups_get_group( $item_id );
    1230                                         $link  = bp_get_group_permalink( $group );
     1230                                        $link  = bp_get_group_url( $group );
    12311231                                        $name  = $group->name;
    12321232                                }
     
    16111611
    16121612                                $generated_content->group_url = array(
    1613                                         'value'             => bp_get_group_permalink( $group ),
     1613                                        'value'             => bp_get_group_url( $group ),
    16141614                                        'sanitize_callback' => 'esc_url',
    16151615                                );
  • trunk/src/bp-core/deprecated/12.0.php

    r13436 r13437  
    332332        return apply_filters_deprecated( 'bp_get_blogs_directory_permalink', array( $url ), '12.0.0', 'bp_get_blogs_directory_url' );
    333333}
     334
     335/**
     336 * Outputs the group creation numbered steps navbar
     337 *
     338 * @since 3.0.0
     339 * @deprecated 12.0.0
     340 */
     341function bp_nouveau_group_creation_tabs() {
     342        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_group_creation_tabs()' );
     343        bp_group_creation_tabs();
     344}
  • trunk/src/bp-groups/actions/access.php

    r11923 r13437  
    4444                $no_access_args  = array(
    4545                        'message'  => __( 'You are not an admin of this group.', 'buddypress' ),
    46                         'root'     => bp_get_group_permalink( $current_group ),
     46                        'root'     => bp_get_group_url( $current_group ),
    4747                        'redirect' => false
    4848                );
  • trunk/src/bp-groups/actions/create.php

    r13177 r13437  
    1818
    1919        // If we're not at domain.org/groups/create/ then return false.
    20         if ( !bp_is_groups_component() || !bp_is_current_action( 'create' ) )
     20        if ( ! bp_is_groups_component() || ! bp_is_current_action( 'create' ) ) {
    2121                return false;
    22 
    23         if ( !is_user_logged_in() )
     22        }
     23
     24        if ( ! is_user_logged_in() ) {
    2425                return false;
    25 
    26         if ( !bp_user_can_create_groups() ) {
     26        }
     27
     28        if ( ! bp_user_can_create_groups() ) {
    2729                bp_core_add_message( __( 'Sorry, you are not allowed to create groups.', 'buddypress' ), 'error' );
    28                 bp_core_redirect( bp_get_groups_directory_permalink() );
     30                bp_core_redirect( bp_get_groups_directory_url() );
    2931        }
    3032
     
    199201                        do_action( 'groups_group_create_complete', $bp->groups->new_group_id );
    200202
    201                         bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     203                        bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) );
    202204                } else {
    203205                        /**
     
    314316function groups_action_sort_creation_steps() {
    315317
    316         if ( !bp_is_groups_component() || !bp_is_current_action( 'create' ) )
     318        if ( ! bp_is_groups_component() || ! bp_is_current_action( 'create' ) ) {
    317319                return false;
     320        }
    318321
    319322        $bp = buddypress();
    320323
    321         if ( !is_array( $bp->groups->group_creation_steps ) )
     324        if ( ! is_array( $bp->groups->group_creation_steps ) ) {
    322325                return false;
     326        }
    323327
    324328        foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) {
    325                 while ( !empty( $temp[$step['position']] ) )
     329                while ( ! empty( $temp[$step['position']] ) ) {
    326330                        $step['position']++;
    327 
    328                 $temp[$step['position']] = array( 'name' => $step['name'], 'slug' => $slug );
     331                }
     332
     333                $temp[ $step['position'] ] = array(
     334                        'rewrite_id' => $step['rewrite_id'],
     335                        'name'       => $step['name'],
     336                        'slug'       => $slug,
     337                );
    329338        }
    330339
    331340        // Sort the steps by their position key.
    332         ksort($temp);
    333         unset($bp->groups->group_creation_steps);
    334 
    335         foreach( (array) $temp as $position => $step )
    336                 $bp->groups->group_creation_steps[$step['slug']] = array( 'name' => $step['name'], 'position' => $position );
     341        ksort( $temp );
     342        unset( $bp->groups->group_creation_steps );
     343
     344        foreach( (array) $temp as $position => $step ) {
     345                $bp->groups->group_creation_steps[ $step['slug'] ] = array(
     346                        'rewrite_id'   => $step['rewrite_id'],
     347                        'default_slug' => $step['slug'],
     348                        'name'         => $step['name'],
     349                        'position'     => $position
     350                );
     351        }
    337352
    338353        /**
  • trunk/src/bp-groups/actions/feed.php

    r12590 r13437  
    3636                'title'         => sprintf( _x( '%1$s | %2$s | Activity', 'Group activity RSS title', 'buddypress' ), bp_get_site_name(), bp_get_current_group_name() ),
    3737
    38                 'link'          => bp_get_group_permalink( $group ),
     38                'link'          => bp_get_group_url( $group ),
    3939
    4040                /* translators: %s: Group Name. */
  • trunk/src/bp-groups/actions/join.php

    r11971 r13437  
    3333                        if ( !groups_check_user_has_invite( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
    3434                                bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' );
    35                                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     35                                bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) );
    3636                        }
    3737                }
     
    4343                        bp_core_add_message( __( 'You joined the group!', 'buddypress' ) );
    4444
    45                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     45                bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) );
    4646        }
    4747
  • trunk/src/bp-groups/actions/leave-group.php

    r12438 r13437  
    4747
    4848                $group = groups_get_current_group();
    49                 $redirect = bp_get_group_permalink( $group );
     49                $redirect = bp_get_group_url( $group );
    5050
    5151                if ( ! $group->is_visible ) {
     
    7878         * Remove invitations where the deleted user is the sender.
    7979         * We'll use groups_uninvite_user() so that notifications will be cleaned up.
    80          */ 
     80         */
    8181        $pending_invites = groups_get_invites( array(
    8282                'inviter_id' => $user_id,
  • trunk/src/bp-groups/actions/random.php

    r11923 r13437  
    1818                $group = BP_Groups_Group::get_random( 1, 1 );
    1919
    20                 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . $group['groups'][0]->slug ) );
     20                bp_core_redirect( bp_get_group_url( $group['groups'][0] ) );
    2121        }
    2222}
  • trunk/src/bp-groups/bp-groups-activity.php

    r13367 r13437  
    107107
    108108        $group      = bp_groups_get_activity_group( $activity->item_id );
    109         $group_link = '<a href="' . esc_url( bp_get_group_permalink( $group ) ) . '">' . esc_html( $group->name ) . '</a>';
     109        $group_link = '<a href="' . esc_url( bp_get_group_url( $group ) ) . '">' . esc_html( $group->name ) . '</a>';
    110110
    111111        /* translators: 1: the user link. 2: the group link. */
     
    136136
    137137        $group      = bp_groups_get_activity_group( $activity->item_id );
    138         $group_link = '<a href="' . esc_url( bp_get_group_permalink( $group ) ) . '">' . esc_html( $group->name ) . '</a>';
     138        $group_link = '<a href="' . esc_url( bp_get_group_url( $group ) ) . '">' . esc_html( $group->name ) . '</a>';
    139139
    140140        /* translators: 1: the user link. 2: the group link. */
     
    176176
    177177        $group      = bp_groups_get_activity_group( $activity->item_id );
    178         $group_link = '<a href="' . esc_url( bp_get_group_permalink( $group ) ) . '">' . esc_html( $group->name ) . '</a>';
     178        $group_link = '<a href="' . esc_url( bp_get_group_url( $group ) ) . '">' . esc_html( $group->name ) . '</a>';
    179179
    180180        /*
     
    233233        $group     = bp_groups_get_activity_group( $activity->item_id );
    234234
    235         $group_link = '<a href="' . esc_url( bp_get_group_permalink( $group ) ) . '">' . esc_html( $group->name ) . '</a>';
     235        $group_link = '<a href="' . esc_url( bp_get_group_url( $group ) ) . '">' . esc_html( $group->name ) . '</a>';
    236236
    237237        // Set the Activity update posted in a Group action.
     
    770770         * @param int    $group_id ID of the group. Passed by reference.
    771771         */
    772         $action = apply_filters_ref_array( 'groups_activity_membership_accepted_action', array( sprintf( __( '%1$s joined the group %2$s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( $group->name ) . '</a>' ), $user_id, &$group ) );
     772        $action = apply_filters_ref_array( 'groups_activity_membership_accepted_action', array( sprintf( __( '%1$s joined the group %2$s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . esc_url( bp_get_group_url( $group ) ) . '">' . esc_html( $group->name ) . '</a>' ), $user_id, &$group ) );
    773773
    774774        // Record in activity streams.
  • trunk/src/bp-groups/bp-groups-admin.php

    r13433 r13437  
    639639        $form_url = remove_query_arg( array( 'action', 'deleted', 'no_admins', 'error', 'error_new', 'success_new', 'error_modified', 'success_modified' ), $_SERVER['REQUEST_URI'] );
    640640        $form_url = add_query_arg( 'action', 'save', $form_url );
     641        $create_url = bp_get_groups_directory_url(
     642                array(
     643                        'create_single_item' => 1,
     644                )
     645        );
    641646
    642647        /**
     
    655660
    656661                <?php if ( is_user_logged_in() && bp_user_can_create_groups() ) : ?>
    657                         <a class="page-title-action" href="<?php echo trailingslashit( bp_get_groups_directory_permalink() . 'create' ); ?>"><?php _e( 'Add New', 'buddypress' ); ?></a>
     662                        <a class="page-title-action" href="<?php echo esc_url( $create_url ); ?>"><?php esc_html_e( 'Add New', 'buddypress' ); ?></a>
    658663                <?php endif; ?>
    659664
     
    684689                                                                                        <strong><?php esc_html_e( 'Permalink:', 'buddypress' ) ?></strong>
    685690                                                                                        <span id="bp-groups-permalink">
    686                                                                                                 <?php bp_groups_directory_permalink(); ?> <input type="text" id="bp-groups-slug" name="bp-groups-slug" value="<?php bp_group_slug( $group ); ?>" autocomplete="off"> /
     691                                                                                                <?php bp_groups_directory_url(); ?> <input type="text" id="bp-groups-slug" name="bp-groups-slug" value="<?php bp_group_slug( $group ); ?>" autocomplete="off"> /
    687692                                                                                        </span>
    688                                                                                         <a href="<?php echo bp_group_permalink( $group ) ?>" class="button button-small" id="bp-groups-visit-group"><?php esc_html_e( 'Visit Group', 'buddypress' ) ?></a>
     693                                                                                        <a href="<?php bp_group_url( $group ) ?>" class="button button-small" id="bp-groups-visit-group"><?php esc_html_e( 'Visit Group', 'buddypress' ) ?></a>
    689694                                                                                </div>
    690695
     
    814819        // Prepare the group items for display.
    815820        $bp_groups_list_table->prepare_items();
     821        $create_url = bp_get_groups_directory_url(
     822                array(
     823                        'create_single_item' => 1,
     824                )
     825        );
    816826
    817827        /**
     
    831841
    832842                <?php if ( is_user_logged_in() && bp_user_can_create_groups() ) : ?>
    833                         <a class="page-title-action" href="<?php echo trailingslashit( bp_get_groups_directory_permalink() . 'create' ); ?>"><?php _e( 'Add New', 'buddypress' ); ?></a>
     843                        <a class="page-title-action" href="<?php echo esc_url( $create_url ); ?>"><?php esc_html_e( 'Add New', 'buddypress' ); ?></a>
    834844                <?php endif; ?>
    835845
  • trunk/src/bp-groups/bp-groups-adminbar.php

    r13395 r13437  
    4646                'id'    => $bp->group_admin_menu_id,
    4747                'title' => __( 'Edit Group', 'buddypress' ),
    48                 'href'  => bp_get_group_permalink( $bp->groups->current_group )
     48                'href'  => bp_get_group_url( $bp->groups->current_group )
    4949        ) );
    5050
  • trunk/src/bp-groups/bp-groups-blocks.php

    r13296 r13437  
    6161        // Group name/link/description variables.
    6262        $group_name        = bp_get_group_name( $group );
    63         $group_link        = bp_get_group_permalink( $group );
     63        $group_link        = bp_get_group_url( $group );
    6464        $group_description = '';
    6565        $group_content     = '';
     
    235235
    236236                // Get Member link.
    237                 $group_link = bp_get_group_permalink( $group );
     237                $group_link = bp_get_group_url( $group );
    238238
    239239                // Set the Avatar output.
     
    384384        // Make sure the widget ID is unique.
    385385        $widget_id             = uniqid( 'groups-list-' );
    386         $groups_directory_link = bp_get_groups_directory_permalink();
     386        $groups_directory_link = bp_get_groups_directory_url();
    387387
    388388        // Set the Block's title.
     
    465465                                        'php',
    466466                                        array(
    467                                                 'data.link'              => bp_get_group_permalink( $group ),
     467                                                'data.link'              => bp_get_group_url( $group ),
    468468                                                'data.name'              => bp_get_group_name( $group ),
    469469                                                'data.avatar_urls.thumb' => bp_core_fetch_avatar(
  • trunk/src/bp-groups/bp-groups-filters.php

    r12906 r13437  
    3434
    3535add_filter( 'bp_get_group_name',                    'wp_filter_kses',        1 );
    36 add_filter( 'bp_get_group_permalink',               'wp_filter_kses',        1 );
     36add_filter( 'bp_get_group_url',                     'wp_filter_kses',        1 );
    3737add_filter( 'bp_get_group_description',             'bp_groups_filter_kses', 1 );
    3838add_filter( 'bp_get_group_description_excerpt',     'wp_filter_kses',        1 );
  • trunk/src/bp-groups/bp-groups-functions.php

    r13395 r13437  
    33343334                        array(
    33353335                                'name'  => __( 'Group URL', 'buddypress' ),
    3336                                 'value' => bp_get_group_permalink( $group ),
     3336                                'value' => bp_get_group_url( $group ),
    33373337                        ),
    33383338                );
     
    34233423                        array(
    34243424                                'name'  => __( 'Group URL', 'buddypress' ),
    3425                                 'value' => bp_get_group_permalink( $group ),
     3425                                'value' => bp_get_group_url( $group ),
    34263426                        ),
    34273427                        array(
     
    34893489                        array(
    34903490                                'name'  => __( 'Group URL', 'buddypress' ),
    3491                                 'value' => bp_get_group_permalink( $group ),
     3491                                'value' => bp_get_group_url( $group ),
    34923492                        ),
    34933493                        array(
     
    35593559                        array(
    35603560                                'name'  => __( 'Group URL', 'buddypress' ),
    3561                                 'value' => bp_get_group_permalink( $group ),
     3561                                'value' => bp_get_group_url( $group ),
    35623562                        ),
    35633563                        array(
     
    37253725        }
    37263726}
     3727
     3728/**
     3729 * Returns the Group restricted screens.
     3730 *
     3731 * @since 12.0.0
     3732 *
     3733 * @return array The list of the Group restricted screens.
     3734 */
     3735function bp_get_group_restricted_screens() {
     3736        return array(
     3737                'bp_group_create'      => array(
     3738                        'rewrite_id' => 'bp_group_create',
     3739                        'slug'       => 'create',
     3740                        'name'       => _x( 'Create Group root slug', 'Group create restricted rewrite id', 'buddypress' ),
     3741                        'context'    => 'create',
     3742                ),
     3743                'bp_group_create_step' => array(
     3744                        'rewrite_id' => 'bp_group_create_step',
     3745                        'slug'       => 'step',
     3746                        'name'       => _x( 'Create step slug', 'Group create restricted rewrite id', 'buddypress' ),
     3747                        'context'    => 'create',
     3748                ),
     3749        );
     3750}
     3751
     3752/**
     3753 * Returns all registered Group Extension front-end screens.
     3754 *
     3755 * @since 12.0.0
     3756 *
     3757 * @param string $context The display context. Required. Defaults to `read`.
     3758 * @return array          The list of registered Group Extension screens.
     3759 */
     3760function bp_get_group_extension_screens( $context = 'read' ) {
     3761        $bp = buddypress();
     3762
     3763        $group_extension_screens = array(
     3764                'create' => array(),
     3765                'manage' => array(),
     3766                'read'   => array(),
     3767        );
     3768
     3769        if ( $bp->groups->group_extensions ) {
     3770                foreach ( $bp->groups->group_extensions as $extension_screens ) {
     3771                        if ( ! is_array( $extension_screens ) ) {
     3772                                continue;
     3773                        }
     3774
     3775                        foreach ( $extension_screens as $ctext => $extension_screen ) {
     3776                                $group_extension_screens[ $ctext ] = array_merge( $group_extension_screens[ $ctext ], $extension_screen );
     3777                        }
     3778                }
     3779        }
     3780
     3781        if ( ! array_filter( $group_extension_screens ) || ! isset( $group_extension_screens[ $context ] ) ) {
     3782                return array();
     3783        }
     3784
     3785        return $group_extension_screens[ $context ];
     3786}
     3787
     3788/**
     3789 * Returns all potential Group screens.
     3790 *
     3791 * @since 12.0.0
     3792 *
     3793 * @param string $context The display context. Required. Defaults to `read`.
     3794 * @return array          The list of potential Group screens.
     3795 */
     3796function bp_get_group_screens( $context = 'read' ) {
     3797        $screens = array(
     3798                'create' => array(
     3799                        'group-details'     => array(
     3800                                'rewrite_id' => 'bp_group_create_group_details',
     3801                                'slug'       => 'group-details',
     3802                                'name'       => _x( 'Details', 'Group create screen', 'buddypress' ),
     3803                                'position'   => 0,
     3804                        ),
     3805                        'group-settings'    => array(
     3806                                'rewrite_id' => 'bp_group_create_group_settings',
     3807                                'slug'       => 'group-settings',
     3808                                'name'       => _x( 'Settings', 'Group create screen', 'buddypress' ),
     3809                                'position'   => 10,
     3810                        ),
     3811                        'group-avatar'      => array(
     3812                                'rewrite_id' => 'bp_group_create_group_avatar',
     3813                                'slug'       => 'group-avatar',
     3814                                'name'       => _x( 'Photo', 'Group create screen', 'buddypress' ),
     3815                                'position'   => 20,
     3816                        ),
     3817                        'group-cover-image' => array(
     3818                                'rewrite_id' => 'bp_group_create_group_cover_image',
     3819                                'slug'       => 'group-cover-image',
     3820                                'name'       => _x( 'Cover Image', 'Group create screen', 'buddypress' ),
     3821                                'position'   => 25,
     3822                        ),
     3823                        'group-invites'     => array(
     3824                                'rewrite_id' => 'bp_group_create_group_invites',
     3825                                'slug'       => 'group-invites',
     3826                                'name'       => _x( 'Invites', 'Group create screen', 'buddypress' ),
     3827                                'position'   => 30,
     3828                        ),
     3829                ),
     3830                'read'   => array(
     3831                        'home'               => array(
     3832                                'rewrite_id'      => 'bp_group_read_home',
     3833                                'slug'            => 'home',
     3834                                'name'            => _x( 'Home', 'Group read screen', 'buddypress' ),
     3835                                'screen_function' => 'groups_screen_group_home',
     3836                                'position'        => 10,
     3837                                'item_css_id'     => 'home',
     3838                        ),
     3839                        'request-membership' => array(
     3840                                'rewrite_id'      => 'bp_group_read_request_membership',
     3841                                'slug'            => 'request-membership',
     3842                                'name'            => _x( 'Request Membership', 'Group read screen', 'buddypress' ),
     3843                                'screen_function' => 'groups_screen_group_request_membership',
     3844                                'position'        => 30,
     3845                        ),
     3846                        'members'            => array(
     3847                                'rewrite_id'      => 'bp_group_read_members',
     3848                                'slug'            => 'members',
     3849                                /* translators: %s: total member count */
     3850                                'name'            => _x( 'Members %s', 'Group read screen', 'buddypress' ),
     3851                                'screen_function' => 'groups_screen_group_members',
     3852                                'position'        => 60,
     3853                                'user_has_access' => false,
     3854                                'no_access_url'   => '',
     3855                                'item_css_id'     => 'members',
     3856                        ),
     3857                        'send-invites'       => array(
     3858                                'rewrite_id'      => 'bp_group_read_send_invites',
     3859                                'slug'            => 'send-invites',
     3860                                'name'            => _x( 'Send Invites', 'Group read screen', 'buddypress' ),
     3861                                'screen_function' => 'groups_screen_group_invite',
     3862                                'position'        => 70,
     3863                                'user_has_access' => false,
     3864                                'no_access_url'   => '',
     3865                                'item_css_id'     => 'invite',
     3866                        ),
     3867                        'admin'              => array(
     3868                                'rewrite_id'      => 'bp_group_read_admin',
     3869                                'slug'            => 'admin',
     3870                                'name'            => _x( 'Manage', 'Group read screen', 'buddypress' ),
     3871                                'screen_function' => 'groups_screen_group_admin',
     3872                                'position'        => 1000,
     3873                                'user_has_access' => false,
     3874                                'no_access_url'   => '',
     3875                                'item_css_id'     => 'admin',
     3876                        ),
     3877                ),
     3878                'manage' => array(
     3879                        'edit-details'        => array(
     3880                                'rewrite_id'        => 'bp_group_manage_edit_details',
     3881                                'slug'              => 'edit-details',
     3882                                'name'              => _x( 'Details', 'Group manage screen', 'buddypress' ),
     3883                                'screen_function'   => 'groups_screen_group_admin',
     3884                                'position'          => 0,
     3885                                'user_has_access'   => false,
     3886                                'show_in_admin_bar' => true,
     3887                        ),
     3888                        'group-settings'      => array(
     3889                                'rewrite_id'        => 'bp_group_manage_group_settings',
     3890                                'slug'              => 'group-settings',
     3891                                'name'              => _x( 'Settings', 'Group manage screen', 'buddypress' ),
     3892                                'screen_function'   => 'groups_screen_group_admin',
     3893                                'position'          => 10,
     3894                                'user_has_access'   => false,
     3895                                'show_in_admin_bar' => true,
     3896                        ),
     3897                        'group-avatar'        => array(
     3898                                'rewrite_id'        => 'bp_group_manage_group_avatar',
     3899                                'slug'              => 'group-avatar',
     3900                                'name'              => _x( 'Photo', 'Group manage screen', 'buddypress' ),
     3901                                'screen_function'   => 'groups_screen_group_admin',
     3902                                'position'          => 20,
     3903                                'user_has_access'   => false,
     3904                                'show_in_admin_bar' => true,
     3905                        ),
     3906                        'group-cover-image'   => array(
     3907                                'rewrite_id'        => 'bp_group_manage_group_cover_image',
     3908                                'slug'              => 'group-cover-image',
     3909                                'name'              => _x( 'Cover Image', 'Group manage screen', 'buddypress' ),
     3910                                'screen_function'   => 'groups_screen_group_admin',
     3911                                'position'          => 25,
     3912                                'user_has_access'   => false,
     3913                                'show_in_admin_bar' => true,
     3914                        ),
     3915                        'manage-members'      => array(
     3916                                'rewrite_id'        => 'bp_group_manage_manage_members',
     3917                                'slug'              => 'manage-members',
     3918                                'name'              => _x( 'Members', 'Group manage screen', 'buddypress' ),
     3919                                'screen_function'   => 'groups_screen_group_admin',
     3920                                'position'          => 30,
     3921                                'user_has_access'   => false,
     3922                                'show_in_admin_bar' => true,
     3923                        ),
     3924                        'membership-requests' => array(
     3925                                'rewrite_id'        => 'bp_group_manage_membership_requests',
     3926                                'slug'              => 'membership-requests',
     3927                                'name'              => _x( 'Requests', 'Group manage screen', 'buddypress' ),
     3928                                'screen_function'   => 'groups_screen_group_admin',
     3929                                'position'          => 40,
     3930                                'user_has_access'   => false,
     3931                                'show_in_admin_bar' => true,
     3932                        ),
     3933                        'delete-group'        => array(
     3934                                'rewrite_id'        => 'bp_group_manage_delete_group',
     3935                                'slug'              => 'delete-group',
     3936                                'name'              => _x( 'Delete', 'Group manage screen', 'buddypress' ),
     3937                                'screen_function'   => 'groups_screen_group_admin',
     3938                                'position'          => 1000,
     3939                                'user_has_access'   => false,
     3940                                'show_in_admin_bar' => true,
     3941                        ),
     3942                ),
     3943        );
     3944
     3945        if ( ! isset( $screens[ $context ] ) ) {
     3946                return array();
     3947        }
     3948
     3949        $context_screens         = array();
     3950        $custom_screens          = apply_filters( 'bp_get_group_custom_' . $context . '_screens', $context_screens );
     3951        $group_extension_screens = bp_get_group_extension_screens( $context );
     3952
     3953        if ( $group_extension_screens ) {
     3954                $custom_screens = array_merge( $custom_screens, $group_extension_screens );
     3955        }
     3956
     3957        if ( $custom_screens && ! wp_is_numeric_array( $custom_screens ) ) {
     3958                // The screen key (used as default slug) and `rewrite_id` prop need to be unique.
     3959                $valid_custom_screens   = array_diff_key( $custom_screens, $screens[ $context ] );
     3960                $existing_rewrite_ids = array_column( $screens[ $context ], 'rewrite_id' );
     3961                $existing_rewrite_ids = array_merge(
     3962                        $existing_rewrite_ids,
     3963                        // BP Group Reserved rewrite IDs.
     3964                        array_keys( bp_get_group_restricted_screens() )
     3965                );
     3966
     3967                foreach ( $valid_custom_screens as $key_screen => $screen ) {
     3968                        if ( ! isset( $screen['rewrite_id'] ) || ! in_array( $screen['rewrite_id'], $existing_rewrite_ids, true ) ) {
     3969                                continue;
     3970                        }
     3971
     3972                        unset( $valid_custom_screens[ $key_screen ] );
     3973                }
     3974
     3975                $context_screens = array_merge( $screens[ $context ], $valid_custom_screens );
     3976        } else {
     3977                $context_screens = $screens[ $context ];
     3978        }
     3979
     3980        return $context_screens;
     3981}
  • trunk/src/bp-groups/bp-groups-notifications.php

    r13436 r13437  
    5252                                /* translators: 1: the old group permalink. 2: the new group permalink. */
    5353                                _x( '* Permalink changed from "%1$s" to "%2$s".', 'Group update email text', 'buddypress' ),
    54                                 esc_url( bp_get_group_permalink( $old_group ) ),
    55                                 esc_url( bp_get_group_permalink( $group ) )
     54                                esc_url( bp_get_group_url( $old_group ) ),
     55                                esc_url( bp_get_group_url( $group ) )
    5656                        );
    5757                }
     
    9090                                'group'        => $group,
    9191                                'group.id'     => $group_id,
    92                                 'group.url'    => esc_url( bp_get_group_permalink( $group ) ),
     92                                'group.url'    => esc_url( bp_get_group_url( $group ) ),
    9393                                'group.name'   => $group->name,
    9494                                'unsubscribe'  => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
     
    216216                        'group.id'           => $group_id,
    217217                        'group.name'         => $group->name,
    218                         'group.url'          => esc_url( bp_get_group_permalink( $group ) ),
     218                        'group.url'          => esc_url( bp_get_group_url( $group ) ),
    219219                        'requesting-user.id' => $requesting_user_id,
    220220                ),
     
    291291                        'group'       => $group,
    292292                        'group.id'    => $group_id,
    293                         'group.url'   => esc_url( bp_get_group_permalink( $group ) ),
     293                        'group.url'   => esc_url( bp_get_group_url( $group ) ),
    294294                        'group.name'  => $group->name,
    295295                        'promoted_to' => $promoted_to,
     
    363363                'tokens' => array(
    364364                        'group'          => $group,
    365                         'group.url'      => bp_get_group_permalink( $group ),
     365                        'group.url'      => esc_url( bp_get_group_url( $group ) ),
    366366                        'group.name'     => $group->name,
    367367                        'inviter.name'   => bp_core_get_userlink( $inviter_user_id, true, false ),
     
    397397        switch ( $action ) {
    398398                case 'new_membership_request':
    399                         $group_id = $item_id;
     399                        $group_id           = $item_id;
    400400                        $requesting_user_id = $secondary_item_id;
    401401
    402                         $group = groups_get_group( $group_id );
    403                         $group_link = bp_get_group_permalink( $group );
    404                         $amount = 'single';
    405 
    406                         // Set up the string and the filter
    407                         // because different values are passed to the filters,
    408                         // we'll return values inline.
     402                        $group      = groups_get_group( $group_id );
     403                        $group_link = bp_get_group_url( $group );
     404                        $amount     = 'single';
     405
     406                        /*
     407                         * Set up the string and the filter
     408                         * because different values are passed to the filters,
     409                         * we'll return values inline.
     410                         */
    409411                        if ( (int) $total_items > 1 ) {
    410412                                /* translators: 1: number of group membership requests. 2: group name. */
    411                                 $text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
    412                                 $amount = 'multiple';
    413                                 $notification_link = $group_link . 'admin/membership-requests/?n=1';
     413                                $text              = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
     414                                $amount            = 'multiple';
     415                                $notification_link = add_query_arg(
     416                                        array(
     417                                                'n' => 1,
     418                                        ),
     419                                        bp_get_group_url(
     420                                                $group,
     421                                                array(
     422                                                        'single_item_action'           => bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ),
     423                                                        'single_item_action_variables' => array( bp_rewrites_get_slug( 'groups', 'bp_group_manage_membership_requests', 'membership-requests' ) ),
     424                                                )
     425                                        )
     426                                );
    414427
    415428                                if ( 'string' == $format ) {
     
    430443                                         * @param string $notification_link The permalink for notification.
    431444                                         */
    432                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $total_items, $group->name, $text, $notification_link );
     445                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . 's_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $total_items, $group->name, $text, $notification_link );
    433446                                } else {
    434447
     
    455468                        } else {
    456469                                $user_fullname = bp_core_get_user_displayname( $requesting_user_id );
     470
    457471                                /* translators: %s: member name */
    458                                 $text = sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname );
    459                                 $notification_link = $group_link . 'admin/membership-requests/?n=1';
     472                                $text              = sprintf( __( '%s requests group membership', 'buddypress' ), $user_fullname );
     473                                $notification_link = $notification_link = add_query_arg(
     474                                        array(
     475                                                'n' => 1,
     476                                        ),
     477                                        bp_get_group_url(
     478                                                $group,
     479                                                array(
     480                                                        'single_item_action'           => bp_rewrites_get_slug( 'groups', 'bp_group_read_admin', 'admin' ),
     481                                                        'single_item_action_variables' => array( bp_rewrites_get_slug( 'groups', 'bp_group_manage_membership_requests', 'membership-requests' ) ),
     482                                                )
     483                                        )
     484                                );
    460485
    461486                                if ( 'string' == $format ) {
     
    476501                                         * @param string $notification_link The permalink for notification.
    477502                                         */
    478                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $user_fullname, $group->name, $text, $notification_link );
     503                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $user_fullname, $group->name, $text, $notification_link );
    479504                                } else {
    480505
     
    506531                        $group_id = $item_id;
    507532
    508                         $group = groups_get_group( $group_id );
    509                         $group_link = bp_get_group_permalink( $group );
    510                         $amount = 'single';
     533                        $group      = groups_get_group( $group_id );
     534                        $group_link = bp_get_group_url( $group );
     535                        $amount     = 'single';
    511536
    512537                        if ( (int) $total_items > 1 ) {
    513538                                /* translators: 1: number of accepted group membership requests. 2: group name. */
    514                                 $text = sprintf( __( '%1$d accepted group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
    515                                 $amount = 'multiple';
     539                                $text              = sprintf( __( '%1$d accepted group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
     540                                $amount            = 'multiple';
    516541                                $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
    517542
     
    530555                                         * @param string $notification_link The permalink for notification.
    531556                                         */
    532                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $group->name, $text, $notification_link );
     557                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $total_items, $group->name, $text, $notification_link );
    533558                                } else {
    534559
     
    552577                        } else {
    553578                                /* translators: %s: group name. */
    554                                 $text = sprintf( __( 'Membership for group "%s" accepted', 'buddypress' ), $group->name );
    555                                 $filter = 'bp_groups_single_membership_request_accepted_notification';
    556                                 $notification_link = $group_link . '?n=1';
     579                                $text              = sprintf( __( 'Membership for group "%s" accepted', 'buddypress' ), $group->name );
     580                                $filter            = 'bp_groups_single_membership_request_accepted_notification';
     581                                $notification_link = add_query_arg( 'n', 1, $group_link );
    557582
    558583                                if ( 'string' == $format ) {
     
    570595                                         * @param string $notification_link The permalink for notification.
    571596                                         */
    572                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     597                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link );
    573598                                } else {
    574599
     
    597622                        $group_id = $item_id;
    598623
    599                         $group = groups_get_group( $group_id );
    600                         $group_link = bp_get_group_permalink( $group );
    601                         $amount = 'single';
     624                        $group      = groups_get_group( $group_id );
     625                        $group_link = bp_get_group_url( $group );
     626                        $amount     = 'single';
    602627
    603628                        if ( (int) $total_items > 1 ) {
    604629                                /* translators: 1: number of accepted group membership requests. 2: group name. */
    605                                 $text = sprintf( __( '%1$d rejected group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
    606                                 $amount = 'multiple';
     630                                $text              = sprintf( __( '%1$d rejected group membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
     631                                $amount            = 'multiple';
    607632                                $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
    608633
     
    621646                                         * @param string $notification_link The permalink for notification.
    622647                                         */
    623                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $group->name, $text, $notification_link );
     648                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $total_items, $group->name, $text, $notification_link );
    624649                                } else {
    625650
     
    643668                        } else {
    644669                                /* translators: %s: group name. */
    645                                 $text = sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name );
    646                                 $notification_link = $group_link . '?n=1';
     670                                $text              = sprintf( __( 'Membership for group "%s" rejected', 'buddypress' ), $group->name );
     671                                $notification_link = add_query_arg( 'n', 1, $group_link );
    647672
    648673                                if ( 'string' == $format ) {
     
    660685                                         * @param string $notification_link The permalink for notification.
    661686                                         */
    662                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     687                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link );
    663688                                } else {
    664689
     
    687712                        $group_id = $item_id;
    688713
    689                         $group = groups_get_group( $group_id );
    690                         $group_link = bp_get_group_permalink( $group );
    691                         $amount = 'single';
     714                        $group      = groups_get_group( $group_id );
     715                        $group_link = bp_get_group_url( $group );
     716                        $amount     = 'single';
    692717
    693718                        if ( (int) $total_items > 1 ) {
    694719                                /* translators: %d: number of groups the user has been promoted admin for */
    695                                 $text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int) $total_items );
    696                                 $amount = 'multiple';
     720                                $text              = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int) $total_items );
     721                                $amount            = 'multiple';
    697722                                $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
    698723
     
    709734                                         * @param string $notification_link The permalink for notification.
    710735                                         */
    711                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $text, $notification_link );
     736                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $total_items, $text, $notification_link );
    712737                                } else {
    713738                                        /**
     
    729754                        } else {
    730755                                /* translators: %s: group name. */
    731                                 $text = sprintf( __( 'You were promoted to an admin in the group "%s"', 'buddypress' ), $group->name );
    732                                 $notification_link = $group_link . '?n=1';
     756                                $text              = sprintf( __( 'You were promoted to an admin in the group "%s"', 'buddypress' ), $group->name );
     757                                $notification_link = add_query_arg( 'n', 1, $group_link );
    733758
    734759                                if ( 'string' == $format ) {
     
    745770                                         * @param string $notification_link The permalink for notification.
    746771                                         */
    747                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     772                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link );
    748773                                } else {
    749774                                        /**
     
    771796                        $group_id = $item_id;
    772797
    773                         $group = groups_get_group( $group_id );
    774                         $group_link = bp_get_group_permalink( $group );
    775                         $amount = 'single';
     798                        $group      = groups_get_group( $group_id );
     799                        $group_link = bp_get_group_url( $group );
     800                        $amount     = 'single';
    776801
    777802                        if ( (int) $total_items > 1 ) {
    778803                                /* translators: %d: number of groups the user has been promoted mod for */
    779                                 $text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int) $total_items );
    780                                 $amount = 'multiple';
     804                                $text              = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int) $total_items );
     805                                $amount            = 'multiple';
    781806                                $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
    782807
     
    793818                                         * @param string $notification_link The permalink for notification.
    794819                                         */
    795                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $total_items, $text, $notification_link );
     820                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $total_items, $text, $notification_link );
    796821                                } else {
    797822                                        /**
     
    813838                        } else {
    814839                                /* translators: %s: group name. */
    815                                 $text = sprintf( __( 'You were promoted to a mod in the group "%s"', 'buddypress' ), $group->name );
    816                                 $notification_link = $group_link . '?n=1';
     840                                $text              = sprintf( __( 'You were promoted to a mod in the group "%s"', 'buddypress' ), $group->name );
     841                                $notification_link = add_query_arg( 'n', 1, $group_link );
    817842
    818843                                if ( 'string' == $format ) {
     
    829854                                         * @param string $notification_link The permalink for notification.
    830855                                         */
    831                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     856                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link );
    832857                                } else {
    833858                                        /**
     
    853878
    854879                case 'group_invite':
    855                         $group_id = $item_id;
    856                         $group = groups_get_group( $group_id );
    857                         $group_link = bp_get_group_permalink( $group );
    858                         $amount = 'single';
     880                        $group_id   = $item_id;
     881                        $group      = groups_get_group( $group_id );
     882                        $group_link = bp_get_group_url( $group );
     883                        $amount     = 'single';
    859884
    860885                        $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1';
     
    897922                        } else {
    898923                                /* translators: %s: group name. */
    899                                 $text = sprintf( __( 'You have an invitation to the group: %s', 'buddypress' ), $group->name );
     924                                $text   = sprintf( __( 'You have an invitation to the group: %s', 'buddypress' ), $group->name );
    900925                                $filter = 'bp_groups_single_group_invite_notification';
    901926
     
    913938                                         * @param string $notification_link The permalink for notification.
    914939                                         */
    915                                         return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . $notification_link . '">' . $text . '</a>', $group_link, $group->name, $text, $notification_link );
     940                                        return apply_filters( 'bp_groups_' . $amount . '_' . $action . '_notification', '<a href="' . esc_url( $notification_link ) . '">' . esc_html( $text ) . '</a>', $group_link, $group->name, $text, $notification_link );
    916941                                } else {
    917942                                        /**
     
    12571282                        'group.id'        => $group_id,
    12581283                        'group.name'      => $group->name,
    1259                         'group.url'       => esc_url( bp_get_group_permalink( $group ) ),
     1284                        'group.url'       => esc_url( bp_get_group_url( $group ) ),
    12601285                        'leave-group.url' => esc_url(
    12611286                                bp_members_get_user_url(
  • trunk/src/bp-groups/bp-groups-template.php

    r13436 r13437  
    118118 */
    119119function bp_get_groups_directory_url( $path_chunks = array() ) {
    120         $supported_chunks = array_fill_keys( array( 'create_single_item', 'directory_type' ), true );
     120        $supported_chunks = array_fill_keys( array( 'create_single_item', 'create_single_item_variables', 'directory_type' ), true );
    121121
    122122        $path_chunks = bp_parse_args(
     
    12371237
    12381238/**
    1239  * Output the permalink for the group.
    1240  *
    1241  * @since 1.0.0
     1239 * Output the URL for the group.
     1240 *
     1241 * @since 12.0.0
    12421242 *
    12431243 * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
    12441244 *                                                Default: false.
    12451245 */
     1246function bp_group_url( $group = false ) {
     1247        echo esc_url( bp_get_group_url( $group ) );
     1248}
     1249
     1250/**
     1251 * Returns the Groups single item's URL.
     1252 *
     1253 * @since 12.0.0
     1254 *
     1255 * @param integer|BP_Groups_Group $group The group ID or the Group object.
     1256 * @param array                   $path_chunks {
     1257 *     An array of arguments. Optional.
     1258 *
     1259 *     @type string $single_item_component        The component slug the action is relative to.
     1260 *     @type string $single_item_action           The slug of the action to perform.
     1261 *     @type array  $single_item_action_variables An array of additional informations about the action to perform.
     1262 * }
     1263 * @return string The URL built for the BP Rewrites URL parser.
     1264 */
     1265function bp_get_group_url( $group = 0, $path_chunks = array() ) {
     1266        $url  = '';
     1267        $slug = groups_get_slug( $group );
     1268
     1269        if ( $group instanceof BP_Groups_Group ) {
     1270                $group_id = (int) $group->id;
     1271        } else {
     1272                $group_id = (int) $group;
     1273        }
     1274
     1275        if ( $slug ) {
     1276                $supported_chunks = array_fill_keys( array( 'single_item_component', 'single_item_action', 'single_item_action_variables' ), true );
     1277                $path_chunks      = bp_parse_args(
     1278                        array_intersect_key( $path_chunks, $supported_chunks ),
     1279                        array(
     1280                                'component_id' => 'groups',
     1281                                'single_item'  => $slug,
     1282                        )
     1283                );
     1284
     1285                $url = bp_rewrites_get_url( $path_chunks );
     1286        }
     1287
     1288        /**
     1289         * Filters the URL for the passed group.
     1290         *
     1291         * @since 12.0.0
     1292         *
     1293         * @param string  $url      The group url.
     1294         * @param integer $group_id The group ID.
     1295         * @param string  $slug     The group slug.
     1296         * @param array   $path_chunks {
     1297         *     An array of arguments. Optional.
     1298         *
     1299         *     @type string $single_item_component        The component slug the action is relative to.
     1300         *     @type string $single_item_action           The slug of the action to perform.
     1301         *     @type array  $single_item_action_variables An array of additional informations about the action to perform.
     1302         * }
     1303         */
     1304        return apply_filters( 'bp_get_group_url', $url, $group_id, $slug, $path_chunks );
     1305}
     1306
     1307/**
     1308 * Output the permalink for the group.
     1309 *
     1310 * @since 1.0.0
     1311 * @deprecated 12.0.0
     1312 *
     1313 * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     1314 *                                                Default: false.
     1315 */
    12461316function bp_group_permalink( $group = false ) {
    1247         echo bp_get_group_permalink( $group );
     1317        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_group_url' );
     1318        bp_group_url( $group );
    12481319}
    12491320        /**
     
    12581329         */
    12591330        function bp_get_group_permalink( $group = false ) {
    1260                 $group = bp_get_group( $group );
    1261 
    1262                 if ( empty( $group->id ) ) {
    1263                         return '';
    1264                 }
     1331                /*
     1332                 * This function is used at many places and we need to review all this
     1333                 * places during the 12.0 development cycle. Using BP Rewrites means we
     1334                 * cannot concatenate URL chunks to build our URL anymore. We now need
     1335                 * to use `bp_get_group_url( $group, $array )` and make sure to use
     1336                 * the right arguments inside this `$array`.
     1337                 *
     1338                 * @todo Once every link reviewed, we'll be able to remove this check
     1339                 *       and let PHPUnit tell us the one we forgot, eventually!
     1340                 */
     1341                if ( ! buddypress()->is_phpunit_running ) {
     1342                        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_group_url' );
     1343                }
     1344
     1345                $url = bp_get_group_url( $group );
    12651346
    12661347                /**
     
    12691350                 * @since 1.0.0
    12701351                 * @since 2.5.0 Added the `$group` parameter.
    1271                  *
    1272                  * @param string          $permalink Permalink for the group.
    1273                  * @param BP_Groups_Group $group     The group object.
    1274                  */
    1275                 return apply_filters( 'bp_get_group_permalink', trailingslashit( bp_get_groups_directory_permalink() . bp_get_group_slug( $group ) . '/' ), $group );
     1352                 * @deprecated 12.0.0
     1353                 *
     1354                 * @param string          $url   Permalink for the group.
     1355                 * @param BP_Groups_Group $group The group object.
     1356                 */
     1357                return apply_filters_deprecated( 'bp_get_group_permalink', array( $url, $group ), '12.0.0', 'bp_get_group_url' );
    12761358        }
    12771359
     
    13061388                $link = sprintf(
    13071389                        '<a href="%s" class="bp-group-home-link %s-home-link">%s</a>',
    1308                         esc_url( bp_get_group_permalink( $group ) ),
     1390                        esc_url( bp_get_group_url( $group ) ),
    13091391                        esc_attr( bp_get_group_slug( $group ) ),
    13101392                        esc_html( bp_get_group_name( $group ) )
     
    31993281                }
    32003282
     3283                $views = bp_get_group_screens( 'read' );
     3284                if ( isset( $views[ $page ]['rewrite_id'] ) ) {
     3285                        $page = bp_rewrites_get_slug( 'groups', $views[ $page ]['rewrite_id'], $page );
     3286                }
     3287
     3288                $url = bp_get_group_url(
     3289                        $group,
     3290                        array(
     3291                                'single_item_action' => $page,
     3292                        )
     3293                );
     3294
    32013295                /**
    32023296                 * Filters the 'action' attribute for a group form.
     
    32053299                 * @since 2.5.0 Added the `$group` parameter.
    32063300                 *
    3207                  * @param string          $value Action attribute for a group form.
     3301                 * @param string          $url  Action attribute for a group form.
    32083302                 * @param BP_Groups_Group $group The group object.
    32093303                 * @param int|string|bool $page  Page slug.
    32103304                 */
    3211                 return apply_filters( 'bp_group_form_action', trailingslashit( bp_get_group_permalink( $group ) . $page ), $group, $page );
     3305                return apply_filters( 'bp_group_form_action', $url, $group, $page );
    32123306        }
    32133307
     
    35593653                 * @param object $group Group object.
    35603654                 */
    3561                 return apply_filters( 'bp_get_group_leave_reject_link', bp_get_group_permalink( $group ), $group );
     3655                return apply_filters( 'bp_get_group_leave_reject_link', bp_get_group_url( $group ), $group );
    35623656        }
    35633657
     
    37193813                                                        'wrapper_class'     => 'group-button ' . $group->status,
    37203814                                                        'wrapper_id'        => 'groupbutton-' . $group->id,
    3721                                                         'link_href'         => add_query_arg( 'redirect_to', bp_get_group_permalink( $group ), bp_get_group_accept_invite_link( $group ) ),
     3815                                                        'link_href'         => add_query_arg( 'redirect_to', bp_get_group_url( $group ), bp_get_group_accept_invite_link( $group ) ),
    37223816                                                        'link_text'         => __( 'Accept Invitation', 'buddypress' ),
    37233817                                                        'link_title'        => __( 'Accept Invitation', 'buddypress' ),
     
    37353829                                                        'wrapper_class'     => 'group-button pending ' . $group->status,
    37363830                                                        'wrapper_id'        => 'groupbutton-' . $group->id,
    3737                                                         'link_href'         => bp_get_group_permalink( $group ),
     3831                                                        'link_href'         => bp_get_group_url( $group ),
    37383832                                                        'link_text'         => __( 'Request Sent', 'buddypress' ),
    37393833                                                        'link_title'        => __( 'Request Sent', 'buddypress' ),
     
    38283922                        'link_text'  => __( 'Create a Group', 'buddypress' ),
    38293923                        'link_class' => 'group-create no-ajax',
    3830                         'link_href'  => trailingslashit( bp_get_groups_directory_permalink() . 'create' ),
     3924                        'link_href'  => bp_get_groups_directory_url(
     3925                                array(
     3926                                        'create_single_item' => 1,
     3927                                )
     3928                        ),
    38313929                        'wrapper'    => false,
    38323930                        'block_self' => false,
     
    48904988
    48914989/**
    4892  * @since 1.0.0
    4893  *
    4894  * @return bool
     4990 * Outputs the Group creation tabs.
     4991 *
     4992 * @since 1.0.0
    48954993 */
    48964994function bp_group_creation_tabs() {
    4897         $bp = buddypress();
    4898 
    4899         if ( !is_array( $bp->groups->group_creation_steps ) ) {
     4995        $bp           = buddypress();
     4996        $create_steps = $bp->groups->group_creation_steps;
     4997
     4998        if ( ! is_array( $create_steps ) ) {
    49004999                return false;
    49015000        }
    49025001
    4903         if ( !bp_get_groups_current_create_step() ) {
    4904                 $keys = array_keys( $bp->groups->group_creation_steps );
     5002        if ( ! bp_get_groups_current_create_step() ) {
     5003                $keys                            = array_keys( $create_steps );
    49055004                $bp->groups->current_create_step = array_shift( $keys );
    49065005        }
     
    49085007        $counter = 1;
    49095008
    4910         foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) {
    4911                 $is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?>
    4912 
    4913                 <li<?php if ( bp_get_groups_current_create_step() == $slug ) : ?> class="current"<?php endif; ?>><?php if ( $is_enabled ) : ?><a href="<?php bp_groups_directory_permalink(); ?>create/step/<?php echo $slug ?>/"><?php else: ?><span><?php endif; ?><?php echo $counter ?>. <?php echo $step['name'] ?><?php if ( $is_enabled ) : ?></a><?php else: ?></span><?php endif ?></li><?php
     5009        foreach ( (array) $create_steps as $create_step => $step ) {
     5010                $is_enabled    = bp_are_previous_group_creation_steps_complete( $create_step );
     5011                $current_class = '';
     5012                $step_name     = $step['name'];
     5013
     5014                if ( bp_get_groups_current_create_step() === $create_step ) {
     5015                        $current_class = ' class="current"';
     5016                }
     5017
     5018                if ( $is_enabled && isset( $create_steps[ $create_step ]['rewrite_id'], $create_steps[ $create_step ]['default_slug'] ) ) {
     5019                        $create_step_slug = bp_rewrites_get_slug( 'groups', 'bp_group_create_step', 'step' );
     5020                        $step_slug        = bp_rewrites_get_slug( 'groups', $create_steps[ $create_step ]['rewrite_id'], $create_steps[ $create_step ]['default_slug'] );
     5021                        $url              = bp_get_groups_directory_url(
     5022                                array(
     5023                                        'create_single_item'           => 1,
     5024                                        'create_single_item_variables' => array( $create_step_slug, $step_slug ),
     5025                                )
     5026                        );
     5027
     5028                        $step_name = sprintf( '<a href="%1$s">%2$s. %3$s</a>', esc_url( $url ), absint( $counter ), esc_html( $step_name ) );
     5029                } else {
     5030                        $step_name = sprintf( '<span>%1$s. %2$s</span>', absint( $counter ), esc_html( $step_name ) );
     5031                }
     5032
     5033
     5034                printf( '<li%1$s>%2$s</li>', $current_class, $step_name );
    49145035                $counter++;
    4915         }
    4916 
    4917         unset( $is_enabled );
     5036                unset( $is_enabled );
     5037        }
    49185038
    49195039        /**
     
    49545074 */
    49555075        function bp_get_group_creation_form_action() {
    4956                 $bp = buddypress();
    4957 
    4958                 if ( !bp_action_variable( 1 ) ) {
    4959                         $keys = array_keys( $bp->groups->group_creation_steps );
     5076                $bp           = buddypress();
     5077                $create_steps = $bp->groups->group_creation_steps;
     5078                $url          = '';
     5079
     5080                if ( ! bp_action_variable( 1 ) ) {
     5081                        $keys = array_keys( $create_steps );
    49605082                        $bp->action_variables[1] = array_shift( $keys );
    49615083                }
    49625084
     5085                $create_step  = bp_action_variable( 1 );
     5086                if ( $create_step && isset( $create_steps[ $create_step ]['rewrite_id'], $create_steps[ $create_step ]['default_slug'] ) ) {
     5087                        $create_step_slug = bp_rewrites_get_slug( 'groups', 'bp_group_create_step', 'step' );
     5088                        $step_slug        = bp_rewrites_get_slug( 'groups', $create_steps[ $create_step ]['rewrite_id'], $create_steps[ $create_step ]['default_slug'] );
     5089
     5090                        $url = bp_get_groups_directory_url(
     5091                                array(
     5092                                        'create_single_item'           => 1,
     5093                                        'create_single_item_variables' => array( $create_step_slug, $step_slug ),
     5094                                )
     5095                        );
     5096                }
     5097
    49635098                /**
    49645099                 * Filters the group creation form action.
     
    49665101                 * @since 1.1.0
    49675102                 *
    4968                  * @param string $value Action to be used with group creation form.
    4969                  */
    4970                 return apply_filters( 'bp_get_group_creation_form_action', trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_action_variable( 1 ) ) );
     5103                 * @param string $url Action to be used with group creation form.
     5104                 */
     5105                return apply_filters( 'bp_get_group_creation_form_action', $url );
    49715106        }
    49725107
     
    52985433         */
    52995434        function bp_get_group_creation_previous_link() {
    5300                 $bp    = buddypress();
    5301                 $steps = array_keys( $bp->groups->group_creation_steps );
     5435                $create_steps = buddypress()->groups->group_creation_steps;
     5436                $steps        = array_keys( $create_steps );
     5437                $url          = '';
    53025438
    53035439                // Loop through steps.
     
    53145450
    53155451                // Generate the URL for the previous step.
    5316                 $group_directory = bp_get_groups_directory_permalink();
    5317                 $create_step     = 'create/step/';
    5318                 $previous_step   = array_pop( $previous_steps );
    5319                 $url             = trailingslashit( $group_directory . $create_step . $previous_step );
     5452                $previous_step = array_pop( $previous_steps );
     5453
     5454                if ( isset( $create_steps[ $previous_step ]['rewrite_id'], $create_steps[ $previous_step ]['default_slug'] ) ) {
     5455                        $create_step_slug = bp_rewrites_get_slug( 'groups', 'bp_group_create_step', 'step' );
     5456                        $previous_step    = bp_rewrites_get_slug( 'groups', $create_steps[ $previous_step ]['rewrite_id'], $create_steps[ $previous_step ]['default_slug'] );
     5457
     5458                        $url = bp_get_groups_directory_url(
     5459                                array(
     5460                                        'create_single_item'           => 1,
     5461                                        'create_single_item_variables' => array( $create_step_slug, $previous_step ),
     5462                                )
     5463                        );
     5464                }
    53205465
    53215466                /**
     
    65826727                                $url = bp_get_group_permalink( $current_group ) . $action;
    65836728                        } else {
    6584                                 $url = bp_get_group_permalink( $current_group );
     6729                                $url = bp_get_group_url( $current_group );
    65856730                        }
    65866731
  • trunk/src/bp-groups/bp-groups-widgets.php

    r13153 r13437  
    6868                        <li <?php bp_group_class(); ?>>
    6969                                <div class="item-avatar">
    70                                         <a href="<?php bp_group_permalink() ?>"><?php bp_group_avatar_thumb() ?></a>
     70                                        <a href="<?php bp_group_url() ?>"><?php bp_group_avatar_thumb() ?></a>
    7171                                </div>
    7272
  • trunk/src/bp-groups/classes/class-bp-group-extension.php

    r13399 r13437  
    731731
    732732                if ( $user_can_see_nav_item ) {
    733                         $group_permalink = bp_get_group_permalink( groups_get_current_group() );
     733                        $group_permalink = bp_get_group_url( groups_get_current_group() );
    734734
    735735                        bp_core_create_subnav_link( array(
     
    750750
    751751                if ( $user_can_visit ) {
    752                         $group_permalink = bp_get_group_permalink( groups_get_current_group() );
     752                        $group_permalink = bp_get_group_url( groups_get_current_group() );
    753753
    754754                        bp_core_register_subnav_screen_function( array(
  • trunk/src/bp-groups/classes/class-bp-groups-component.php

    r13432 r13437  
    375375
    376376                // Set default Group creation steps.
    377                 $group_creation_steps = array(
    378                         'group-details'  => array(
    379                                 'name'       => _x( 'Details', 'Group screen nav', 'buddypress' ),
    380                                 'position'   => 0
    381                         ),
    382                         'group-settings' => array(
    383                                 'name'       => _x( 'Settings', 'Group screen nav', 'buddypress' ),
    384                                 'position'   => 10
    385                         )
    386                 );
    387 
    388                 // If avatar uploads are not disabled, add avatar option.
     377                $group_creation_steps = bp_get_group_screens( 'create' );
     378
     379                // If avatar uploads are disabled, remove avatar view.
    389380                $disabled_avatar_uploads = (int) bp_disable_group_avatar_uploads();
    390                 if ( ! $disabled_avatar_uploads && $bp->avatar->show_avatars ) {
    391                         $group_creation_steps['group-avatar'] = array(
    392                                 'name'     => _x( 'Photo', 'Group screen nav', 'buddypress' ),
    393                                 'position' => 20
    394                         );
    395                 }
    396 
    397                 if ( bp_group_use_cover_image_header() ) {
    398                         $group_creation_steps['group-cover-image'] = array(
    399                                 'name'     => _x( 'Cover Image', 'Group screen nav', 'buddypress' ),
    400                                 'position' => 25
    401                         );
    402                 }
    403 
    404                 // If invitations are enabled, add invitations.
    405                 if ( bp_is_active( 'groups', 'invitations' ) ) {
    406                         $group_creation_steps['group-invites'] = array(
    407                                 'name'     => _x( 'Invites',  'Group screen nav', 'buddypress' ),
    408                                 'position' => 30
    409                         );
     381                if ( $disabled_avatar_uploads || empty( $bp->avatar->show_avatars ) ) {
     382                        unset( $group_creation_steps['group-avatar'] );
     383                }
     384
     385                // If cover images are disabled, remove its view.
     386                if ( ! bp_group_use_cover_image_header() ) {
     387                        unset( $group_creation_steps['group-cover-image'] );
     388                }
     389
     390                // If the invitations feature is not active, remove the corresponding view.
     391                if ( ! bp_is_active( 'groups', 'invitations' ) ) {
     392                        unset( $group_creation_steps['group-invites'] );
    410393                }
    411394
     
    415398                 * @since 1.1.0
    416399                 *
    417                  * @param array $value Array of preconfigured group creation steps.
     400                 * @param array $group_creation_steps Array of preconfigured group creation steps.
    418401                 */
    419402                $this->group_creation_steps = apply_filters( 'groups_create_group_steps', $group_creation_steps );
     
    542525
    543526                // Prepare for a redirect to the canonical URL.
    544                 $bp->canonical_stack['base_url'] = bp_get_group_permalink( $this->current_group );
     527                $bp->canonical_stack['base_url'] = bp_get_group_url( $this->current_group );
    545528
    546529                if ( bp_current_action() ) {
     
    670653                        ), 'groups' );
    671654
    672                         $group_link = bp_get_group_permalink( $this->current_group );
     655                        $group_link = bp_get_group_url( $this->current_group );
    673656
    674657                        // Add the "Home" subnav item, as this will always be present.
     
    919902                                        'id'       => 'my-account-' . $this->id . '-create',
    920903                                        'title'    => _x( 'Create a Group', 'My Account Groups sub nav', 'buddypress' ),
    921                                         'href'     => trailingslashit( bp_get_groups_directory_permalink() . 'create' ),
     904                                        'href'     => bp_get_groups_directory_url(
     905                                                array(
     906                                                        'create_single_item' => 1,
     907                                                )
     908                                        ),
    922909                                        'position' => 90
    923910                                );
     
    1009996                // Just let BP Component fire 'bp_groups_register_taxonomies'.
    1010997                return parent::register_taxonomies();
     998        }
     999
     1000        /**
     1001         * Adds the Groups directory type & Group create rewrite tags.
     1002         *
     1003         * @since 12.0.0
     1004         *
     1005         * @param array $rewrite_tags Optional. See BP_Component::add_rewrite_tags() for
     1006         *                            description.
     1007         */
     1008        public function add_rewrite_tags( $rewrite_tags = array() ) {
     1009                $rewrite_tags = array(
     1010                        'directory_type'               => '([^/]+)',
     1011                        'create_single_item'           => '([1]{1,})',
     1012                        'create_single_item_variables' => '(.+?)',
     1013                );
     1014
     1015                parent::add_rewrite_tags( $rewrite_tags );
     1016        }
     1017
     1018        /**
     1019         * Adds the Groups directory type & Group create rewrite rules.
     1020         *
     1021         * @since 12.0.0
     1022         *
     1023         * @param array $rewrite_rules Optional. See BP_Component::add_rewrite_rules() for
     1024         *                             description.
     1025         */
     1026        public function add_rewrite_rules( $rewrite_rules = array() ) {
     1027                $create_slug = bp_rewrites_get_slug( 'groups', 'group_create', 'create' );
     1028
     1029                $rewrite_rules = array(
     1030                        'directory_type'      => array(
     1031                                'regex' => $this->root_slug . '/' . bp_get_groups_group_type_base() . '/([^/]+)/?$',
     1032                                'order' => 50,
     1033                                'query' => 'index.php?' . $this->rewrite_ids['directory'] . '=1&' . $this->rewrite_ids['directory_type'] . '=$matches[1]',
     1034                        ),
     1035                        'create_single_item' => array(
     1036                                'regex' => $this->root_slug . '/' . $create_slug . '/?$',
     1037                                'order' => 40,
     1038                                'query' => 'index.php?' . $this->rewrite_ids['directory'] . '=1&' . $this->rewrite_ids['create_single_item'] . '=1',
     1039                        ),
     1040                        'create_single_item_variables' => array(
     1041                                'regex' => $this->root_slug . '/' . $create_slug . '/(.+?)/?$',
     1042                                'order' =>30,
     1043                                'query' => 'index.php?' . $this->rewrite_ids['directory'] . '=1&' . $this->rewrite_ids['create_single_item'] . '=1&' . $this->rewrite_ids['create_single_item_variables'] . '=$matches[1]',
     1044                        ),
     1045                );
     1046
     1047                parent::add_rewrite_rules( $rewrite_rules );
    10111048        }
    10121049
  • trunk/src/bp-groups/classes/class-bp-groups-list-table.php

    r13147 r13437  
    589589                $delete_url = wp_nonce_url( $base_url . "&amp;action=delete", 'bp-groups-delete' );
    590590                $edit_url   = $base_url . '&amp;action=edit';
    591                 $view_url   = bp_get_group_permalink( $item_obj );
     591                $view_url   = bp_get_group_url( $item_obj );
    592592
    593593                /**
  • trunk/src/bp-groups/classes/class-bp-groups-widget.php

    r13108 r13437  
    101101                echo $before_widget;
    102102
    103                 $title = ! empty( $instance['link_title'] ) ? '<a href="' . bp_get_groups_directory_permalink() . '">' . $title . '</a>' : $title;
     103                $title = ! empty( $instance['link_title'] ) ? '<a href="' . esc_url( bp_get_groups_directory_url() ) . '">' . $title . '</a>' : $title;
    104104
    105105                echo $before_title . $title . $after_title;
     
    126126                <?php if ( bp_has_groups( $group_args ) ) : ?>
    127127                        <div class="item-options" id="groups-list-options">
    128                                 <a href="<?php bp_groups_directory_permalink(); ?>" id="newest-groups"<?php if ( $instance['group_default'] == 'newest' ) : ?> class="selected"<?php endif; ?>><?php _e("Newest", 'buddypress') ?></a>
     128                                <a href="<?php bp_groups_directory_url(); ?>" id="newest-groups"<?php if ( $instance['group_default'] == 'newest' ) : ?> class="selected"<?php endif; ?>><?php _e("Newest", 'buddypress') ?></a>
    129129                                <span class="bp-separator" role="separator"><?php echo esc_html( $separator ); ?></span>
    130                                 <a href="<?php bp_groups_directory_permalink(); ?>" id="recently-active-groups"<?php if ( $instance['group_default'] == 'active' ) : ?> class="selected"<?php endif; ?>><?php _e("Active", 'buddypress') ?></a>
     130                                <a href="<?php bp_groups_directory_url(); ?>" id="recently-active-groups"<?php if ( $instance['group_default'] == 'active' ) : ?> class="selected"<?php endif; ?>><?php _e("Active", 'buddypress') ?></a>
    131131                                <span class="bp-separator" role="separator"><?php echo esc_html( $separator ); ?></span>
    132                                 <a href="<?php bp_groups_directory_permalink(); ?>" id="popular-groups" <?php if ( $instance['group_default'] == 'popular' ) : ?> class="selected"<?php endif; ?>><?php _e("Popular", 'buddypress') ?></a>
     132                                <a href="<?php bp_groups_directory_url(); ?>" id="popular-groups" <?php if ( $instance['group_default'] == 'popular' ) : ?> class="selected"<?php endif; ?>><?php _e("Popular", 'buddypress') ?></a>
    133133                                <span class="bp-separator" role="separator"><?php echo esc_html( $separator ); ?></span>
    134                                 <a href="<?php bp_groups_directory_permalink(); ?>" id="alphabetical-groups" <?php if ( $instance['group_default'] == 'alphabetical' ) : ?> class="selected"<?php endif; ?>><?php _e("Alphabetical", 'buddypress') ?></a>
     134                                <a href="<?php bp_groups_directory_url(); ?>" id="alphabetical-groups" <?php if ( $instance['group_default'] == 'alphabetical' ) : ?> class="selected"<?php endif; ?>><?php _e("Alphabetical", 'buddypress') ?></a>
    135135                        </div>
    136136
     
    139139                                        <li <?php bp_group_class(); ?>>
    140140                                                <div class="item-avatar">
    141                                                         <a href="<?php bp_group_permalink() ?>" class="bp-tooltip" data-bp-tooltip="<?php bp_group_name() ?>"><?php bp_group_avatar_thumb() ?></a>
     141                                                        <a href="<?php bp_group_url() ?>" class="bp-tooltip" data-bp-tooltip="<?php bp_group_name() ?>"><?php bp_group_avatar_thumb() ?></a>
    142142                                                </div>
    143143
  • trunk/src/bp-groups/screens/single/request-membership.php

    r12719 r13437  
    3333                }
    3434
    35                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     35                bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) );
    3636        }
    3737
     
    6060                        bp_core_add_message( __( 'Your membership request was sent to the group administrator successfully. You will be notified when the group administrator responds to your request.', 'buddypress' ) );
    6161                }
    62                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     62                bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) );
    6363        }
    6464
  • trunk/src/bp-groups/screens/single/send-invites.php

    r12433 r13437  
    4343                 */
    4444                do_action( 'groups_screen_group_invite', $bp->groups->current_group->id );
    45                 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     45                bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) );
    4646
    4747        } elseif ( !bp_action_variable( 0 ) ) {
  • trunk/src/bp-members/classes/class-bp-members-component.php

    r13436 r13437  
    788788
    789789        /**
    790          * Add the Registration and Activation rewrite tags.
     790         * Adds the Members directory type, Registration and Activation rewrite tags.
    791791         *
    792792         * @since 12.0.0
     
    797797        public function add_rewrite_tags( $rewrite_tags = array() ) {
    798798                $rewrite_tags = array(
     799                        'directory_type'      => '([^/]+)',
    799800                        'member_register'     => '([1]{1,})',
    800801                        'member_activate'     => '([1]{1,})',
     
    806807
    807808        /**
    808          * Add the Registration and Activation rewrite rules.
     809         * Adds the Registration and Activation rewrite rules.
    809810         *
    810811         * @since 12.0.0
     
    841842
    842843        /**
    843          * Add the Registration and Activation permastructs.
     844         * Adds the Registration and Activation permastructs.
    844845         *
    845846         * @since 12.0.0
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r13395 r13437  
    16081608                                _e( 'Error requesting membership', 'buddypress' );
    16091609                        } else {
    1610                                 echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button disabled pending membership-requested" rel="membership-requested" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>';
     1610                                echo '<a id="group-' . esc_attr( $group->id ) . '" class="group-button disabled pending membership-requested" rel="membership-requested" href="' . esc_url( bp_get_group_url( $group ) ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>';
    16111611                        }
    16121612                break;
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/groups-loop.php

    r12791 r13437  
    77 * @package BuddyPress
    88 * @subpackage bp-legacy
    9  * @version 3.0.0
     9 * @version 12.0.0
    1010 */
    1111
     
    5959                        <?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
    6060                                <div class="item-avatar">
    61                                         <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a>
     61                                        <a href="<?php bp_group_url(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a>
    6262                                </div>
    6363                        <?php endif; ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/index.php

    r12595 r13437  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 3.0.0
     7 * @version 12.0.0
    88 */
    99
     
    6161                        <ul>
    6262                                <li class="selected" id="groups-all">
    63                                         <a href="<?php bp_groups_directory_permalink(); ?>">
     63                                        <a href="<?php bp_groups_directory_url(); ?>">
    6464                                                <?php
    6565                                                /* translators: %s: all groups count */
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php

    r12791 r13437  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 3.0.0
     7 * @version 12.0.0
    88 */
    99
     
    1616
    1717<div id="cover-image-container">
    18         <a id="header-cover-image" href="<?php echo esc_url( bp_get_group_permalink() ); ?>"></a>
     18        <a id="header-cover-image" href="<?php bp_group_url(); ?>"></a>
    1919
    2020        <div id="item-header-cover-image">
    2121                <?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
    2222                        <div id="item-header-avatar">
    23                                 <a href="<?php echo esc_url( bp_get_group_permalink() ); ?>">
     23                                <a href="<?php bp_group_url(); ?>">
    2424
    2525                                        <?php bp_group_avatar(); ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/group-header.php

    r12791 r13437  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 3.0.0
     7 * @version 12.0.0
    88 */
    99
     
    6060<?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
    6161        <div id="item-header-avatar">
    62                 <a href="<?php echo esc_url( bp_get_group_permalink() ); ?>" class="bp-tooltip" data-bp-tooltip="<?php echo esc_attr( bp_get_group_name() ); ?>">
     62                <a href="<?php bp_group_url(); ?>" class="bp-tooltip" data-bp-tooltip="<?php echo esc_attr( bp_get_group_name() ); ?>">
    6363
    6464                        <?php bp_group_avatar(); ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/groups/invites.php

    r13273 r13437  
    55 * @package BuddyPress
    66 * @subpackage bp-legacy
    7  * @version 11.0.0
     7 * @version 12.0.0
    88 */
    99
     
    2929                                <?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
    3030                                        <div class="item-avatar">
    31                                                 <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a>
     31                                                <a href="<?php bp_group_url(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a>
    3232                                        </div>
    3333                                <?php endif; ?>
  • trunk/src/bp-templates/bp-nouveau/buddypress/groups/groups-loop.php

    r12791 r13437  
    44 *
    55 * @since 3.0.0
    6  * @version 7.0.0
     6 * @version 12.0.0
    77 */
    88
     
    2626                                        <?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
    2727                                                <div class="item-avatar">
    28                                                         <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( bp_nouveau_avatar_args() ); ?></a>
     28                                                        <a href="<?php bp_group_url(); ?>"><?php bp_group_avatar( bp_nouveau_avatar_args() ); ?></a>
    2929                                                </div>
    3030                                        <?php endif; ?>
  • trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/cover-image-header.php

    r12801 r13437  
    44 *
    55 * @since 3.0.0
    6  * @version 7.0.0
     6 * @version 12.0.0
    77 */
    88?>
     
    1414                <?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
    1515                        <div id="item-header-avatar">
    16                                 <a href="<?php echo esc_url( bp_get_group_permalink() ); ?>" title="<?php echo esc_attr( bp_get_group_name() ); ?>">
     16                                <a href="<?php bp_group_url(); ?>" title="<?php echo esc_attr( bp_get_group_name() ); ?>">
    1717
    1818                                        <?php bp_group_avatar(); ?>
  • trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/group-header.php

    r12801 r13437  
    44 *
    55 * @since 3.0.0
    6  * @version 7.0.0
     6 * @version 12.0.0
    77 */
    88?>
     
    1212<?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
    1313        <div id="item-header-avatar">
    14                 <a href="<?php echo esc_url( bp_get_group_permalink() ); ?>" class="bp-tooltip" data-bp-tooltip="<?php echo esc_attr( bp_get_group_name() ); ?>">
     14                <a href="<?php bp_group_url(); ?>" class="bp-tooltip" data-bp-tooltip="<?php echo esc_attr( bp_get_group_name() ); ?>">
    1515
    1616                        <?php bp_group_avatar(); ?>
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/groups/invites.php

    r13273 r13437  
    44 *
    55 * @since 3.0.0
    6  * @version 11.0.0
     6 * @version 12.0.0
    77 */
    88?>
     
    2727                                <?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
    2828                                        <div class="item-avatar">
    29                                                 <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar(); ?></a>
     29                                                <a href="<?php bp_group_url(); ?>"><?php bp_group_avatar(); ?></a>
    3030                                        </div>
    3131                                <?php endif; ?>
  • trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php

    r13433 r13437  
    562562                'slug'      => 'all', // slug is used because BP_Core_Nav requires it, but it's the scope
    563563                'li_class'  => array( 'selected' ),
    564                 'link'      => bp_get_groups_directory_permalink(),
     564                'link'      => bp_get_groups_directory_url(),
    565565                'text'      => __( 'All Groups', 'buddypress' ),
    566566                'count'     => bp_get_total_group_count(),
     
    591591                                'slug'      => 'create', // slug is used because BP_Core_Nav requires it, but it's the scope
    592592                                'li_class'  => array( 'no-ajax', 'group-create', 'create-button' ),
    593                                 'link'      => trailingslashit( bp_get_groups_directory_permalink() . 'create' ),
     593                                'link'      => bp_get_groups_directory_url(
     594                                        array(
     595                                                'create_single_item' => 1,
     596                                        )
     597                                ),
    594598                                'text'      => __( 'Create a Group', 'buddypress' ),
    595599                                'count'     => false,
  • trunk/src/bp-templates/bp-nouveau/includes/groups/template-tags.php

    r13310 r13437  
    251251
    252252        return (int) bp_get_user_meta( $user_id, '_bp_nouveau_restrict_invites_to_friends' );
    253 }
    254 
    255 /**
    256  * Outputs the group creation numbered steps navbar
    257  *
    258  * @since 3.0.0
    259  *
    260  * @todo This output isn't localised correctly.
    261  */
    262 function bp_nouveau_group_creation_tabs() {
    263         $bp = buddypress();
    264 
    265         if ( ! is_array( $bp->groups->group_creation_steps ) ) {
    266                 return;
    267         }
    268 
    269         if ( ! bp_get_groups_current_create_step() ) {
    270                 $keys                            = array_keys( $bp->groups->group_creation_steps );
    271                 $bp->groups->current_create_step = array_shift( $keys );
    272         }
    273 
    274         $counter = 1;
    275 
    276         foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) {
    277                 $is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?>
    278 
    279                 <li<?php if ( bp_get_groups_current_create_step() === $slug ) : ?> class="current"<?php endif; ?>>
    280                         <?php if ( $is_enabled ) : ?>
    281                                 <a href="<?php echo esc_url( bp_groups_directory_permalink() . 'create/step/' . $slug . '/' ); ?>">
    282                                         <?php echo (int) $counter; ?> <?php echo esc_html( $step['name'] ); ?>
    283                                 </a>
    284                         <?php else : ?>
    285                                 <?php echo (int) $counter; ?>. <?php echo esc_html( $step['name'] ); ?>
    286                         <?php endif ?>
    287                 </li>
    288                         <?php
    289                 $counter++;
    290         }
    291 
    292         unset( $is_enabled );
    293 
    294         /**
    295          * Fires at the end of the creation of the group tabs.
    296          *
    297          * @since 1.0.0
    298          */
    299         do_action( 'groups_creation_tabs' );
    300253}
    301254
  • trunk/src/bp-templates/bp-nouveau/includes/template-tags.php

    r13433 r13437  
    22642264
    22652265        } elseif ( bp_is_group() ) {
    2266                 $url = rawurlencode( bp_get_group_permalink( groups_get_current_group() ) );
     2266                $url = rawurlencode( bp_get_group_url( groups_get_current_group() ) );
    22672267
    22682268        } elseif ( ! empty( $r['object'] ) && ! empty( $r['item_id'] ) ) {
     
    22742274
    22752275                        if ( ! empty( $group->id ) ) {
    2276                                 $url = rawurlencode( bp_get_group_permalink( $group ) );
     2276                                $url = rawurlencode( bp_get_group_url( $group ) );
    22772277                        }
    22782278                }
  • trunk/tests/phpunit/testcases/core/nav/backCompat.php

    r13436 r13437  
    5555
    5656                $group = groups_get_group( $g );
    57                 $group_permalink = bp_get_group_permalink( $group );
     57                $group_permalink = bp_get_group_url( $group );
    5858
    5959                $this->go_to( $group_permalink );
     
    303303                        'slug' => 'foo-subnav',
    304304                        'parent_slug' => bp_get_current_group_slug(),
    305                         'parent_url' => bp_get_group_permalink( groups_get_current_group() ),
     305                        'parent_url' => bp_get_group_url( groups_get_current_group() ),
    306306                        'screen_function' => 'foo_subnav',
    307307                ) );
  • trunk/tests/phpunit/testcases/core/nav/bpCoreMaybeHookNewSubnavScreenFunction.php

    r13436 r13437  
    171171                $old_current_user = get_current_user_id();
    172172                $this->set_current_user( $u );
     173                $this->set_permalink_structure( '/%postname%/' );
    173174
    174175                $group = groups_get_group( $g );
    175176
    176                 $this->go_to( bp_get_group_permalink( $group ) );
    177 
    178                 $subnav_item = array(
    179                         'user_has_access' => false,
    180                         'no_access_url' => bp_get_group_permalink( $group ),
    181                 );
    182 
    183                 // Just test relevant info
    184                 $found = bp_core_maybe_hook_new_subnav_screen_function( $subnav_item );
    185                 $this->assertSame( 'failure', $found['status'] );
    186                 $this->assertSame( bp_get_group_permalink( $group ), $found['redirect_args']['root'] );
     177                $this->go_to( bp_get_group_url( $group ) );
     178
     179                $subnav_item = array(
     180                        'user_has_access' => false,
     181                        'no_access_url' => bp_get_group_url( $group ),
     182                );
     183
     184                // Just test relevant info
     185                $found = bp_core_maybe_hook_new_subnav_screen_function( $subnav_item );
     186                $this->assertSame( 'failure', $found['status'] );
     187                $this->assertSame( bp_get_group_url( $group ), $found['redirect_args']['root'] );
    187188
    188189                // Clean up
     
    198199                $group = groups_get_group( $g );
    199200
    200                 $this->go_to( bp_get_group_permalink( $group ) );
     201                $this->go_to( bp_get_group_url( $group ) );
    201202
    202203                $subnav_item = array(
  • trunk/tests/phpunit/testcases/core/nav/bpCoreNewNavItem.php

    r13436 r13437  
    7878                $group = groups_get_group( $g );
    7979
    80                 $this->go_to( bp_get_group_permalink( $group ) );
     80                $this->go_to( bp_get_group_url( $group ) );
    8181
    8282                $this->assertTrue( buddypress()->bp_nav[ $group->slug ]['position'] === -1 );
  • trunk/tests/phpunit/testcases/core/nav/bpCoreRemoveSubnavItem.php

    r11737 r13437  
    7777                // In group context
    7878                $g_obj = groups_get_group( $g1 );
    79                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     79                $this->go_to( bp_get_group_url( $g_obj ) );
    8080
    8181                bp_core_new_subnav_item( array(
     
    8383                        'slug' => 'clam',
    8484                        'parent_slug' => bp_get_current_group_slug(),
    85                         'parent_url' => bp_get_group_permalink( $g_obj ),
     85                        'parent_url' => bp_get_group_url( $g_obj ),
    8686                        'screen_function' => 'clam_subnav',
    8787                ) );
  • trunk/tests/phpunit/testcases/groups/activity.php

    r12395 r13437  
    2525                $g_obj = groups_get_group( $g );
    2626
    27                 $expected = sprintf( __( '%s created the group %s', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . bp_get_group_permalink( $g_obj ) . '">' . $g_obj->name . '</a>' );
     27                $expected = sprintf( __( '%s created the group %s', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . esc_url( bp_get_group_url( $g_obj ) ) . '">' . $g_obj->name . '</a>' );
    2828
    2929                $this->assertSame( $expected, $a_obj->action );
     
    4747                $g_obj = groups_get_group( $g );
    4848
    49                 $expected = sprintf( __( '%s joined the group %s', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . bp_get_group_permalink( $g_obj ) . '">' . $g_obj->name . '</a>' );
     49                $expected = sprintf( __( '%s joined the group %s', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . esc_url( bp_get_group_url( $g_obj ) ) . '">' . $g_obj->name . '</a>' );
    5050
    5151                $this->assertSame( $expected, $a_obj->action );
     
    124124                $this->assertNotEmpty( $a['activities'] );
    125125
    126                 $expected = sprintf( esc_html__( '%s changed the name of the group %s from "%s" to "%s"', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . bp_get_group_permalink( $group ) . '">Foo</a>', $group->name, 'Foo' );
     126                $expected = sprintf( esc_html__( '%s changed the name of the group %s from "%s" to "%s"', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . esc_url( bp_get_group_url( $group ) ) . '">Foo</a>', $group->name, 'Foo' );
    127127                $this->assertSame( $expected, $a['activities'][0]->action );
    128128
     
    156156                $this->assertNotEmpty( $a['activities'] );
    157157
    158                 $expected = sprintf( esc_html__( '%s changed the description of the group %s from "%s" to "%s"', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . bp_get_group_permalink( $group ) . '">' . $group->name . '</a>', $group->description, 'Bar' );
     158                $expected = sprintf( esc_html__( '%s changed the description of the group %s from "%s" to "%s"', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . esc_url( bp_get_group_url( $group ) ) . '">' . $group->name . '</a>', $group->description, 'Bar' );
    159159                $this->assertSame( $expected, $a['activities'][0]->action );
    160160
     
    189189                $this->assertNotEmpty( $a['activities'] );
    190190
    191                 $expected = sprintf( __( '%s changed the permalink of the group %s.', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . bp_get_group_permalink( $new_group_details ) . '">' . $group->name . '</a>' );
     191                $expected = sprintf( __( '%s changed the permalink of the group %s.', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . esc_url( bp_get_group_url( $new_group_details ) ) . '">' . $group->name . '</a>' );
    192192                $this->assertSame( $expected, $a['activities'][0]->action );
    193193
     
    221221                $this->assertNotEmpty( $a['activities'] );
    222222
    223                 $expected = sprintf( __( '%s changed the name and description of the group %s', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . bp_get_group_permalink( $group ) . '">Foo</a>' );
     223                $expected = sprintf( __( '%s changed the name and description of the group %s', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . esc_url( bp_get_group_url( $group ) ) . '">Foo</a>' );
    224224                $this->assertSame( $expected, $a['activities'][0]->action );
    225225
     
    244244                $g_obj = groups_get_group( $g );
    245245
    246                 $expected = sprintf( esc_html__( '%1$s posted an update in the group %2$s', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . esc_url( bp_get_group_permalink( $g_obj ) ) . '">' . esc_html( $g_obj->name ) . '</a>' );
     246                $expected = sprintf( esc_html__( '%1$s posted an update in the group %2$s', 'buddypress' ), bp_core_get_userlink( $u ),  '<a href="' . esc_url( bp_get_group_url( $g_obj ) ) . '">' . esc_html( $g_obj->name ) . '</a>' );
    247247
    248248                $this->assertSame( $expected, $a_obj->action );
  • trunk/tests/phpunit/testcases/groups/class-bp-group-extension.php

    r13436 r13437  
    242242                $e = new $class_name();
    243243
    244                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     244                $this->go_to( bp_get_group_url( $g_obj ) );
    245245
    246246                $e->_register();
     
    266266                $e = new $class_name();
    267267
    268                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     268                $this->go_to( bp_get_group_url( $g_obj ) );
    269269
    270270                $e->_register();
     
    295295                // Test as non-logged-in user
    296296                $this->set_current_user( 0 );
    297                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     297                $this->go_to( bp_get_group_url( $g_obj ) );
    298298                $e->_register();
    299299                $this->assertFalse( isset( buddypress()->bp_options_nav[ $g_obj->slug ][ $e->slug ] ) );
     
    306306                $this->set_current_user( $u );
    307307                $this->add_user_to_group( $u, $g );
    308                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     308                $this->go_to( bp_get_group_url( $g_obj ) );
    309309                $e->_register();
    310310                $this->assertTrue( isset( buddypress()->bp_options_nav[ $g_obj->slug ][ $e->slug ] ) );
     
    340340                // Test as non-logged-in user
    341341                $this->set_current_user( 0 );
    342                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     342                $this->go_to( bp_get_group_url( $g_obj ) );
    343343                $e->_register();
    344344                $this->assertTrue( isset( buddypress()->bp_options_nav[ $g_obj->slug ][ $e->slug ] ) );
     
    351351                $this->set_current_user( $u );
    352352                $this->add_user_to_group( $u, $g );
    353                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     353                $this->go_to( bp_get_group_url( $g_obj ) );
    354354                $e->_register();
    355355                $this->assertTrue( isset( buddypress()->bp_options_nav[ $g_obj->slug ][ $e->slug ] ) );
     
    371371                ) );
    372372                $g_obj = groups_get_group( $g );
    373                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     373                $this->go_to( bp_get_group_url( $g_obj ) );
    374374
    375375                $this->set_current_user( 0 );
     
    398398                ) );
    399399                $g_obj = groups_get_group( $g );
    400                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     400                $this->go_to( bp_get_group_url( $g_obj ) );
    401401
    402402                $e1 = new BPTest_Group_Extension_Access_Anyone();
     
    441441                $this->set_current_user( $u );
    442442
    443                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     443                $this->go_to( bp_get_group_url( $g_obj ) );
    444444
    445445                $e1 = new BPTest_Group_Extension_Access_Anyone();
     
    486486                $this->add_user_to_group( $u, $g );
    487487
    488                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     488                $this->go_to( bp_get_group_url( $g_obj ) );
    489489
    490490                $e1 = new BPTest_Group_Extension_Access_Anyone();
     
    533533                $gm->promote( 'mod' );
    534534
    535                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     535                $this->go_to( bp_get_group_url( $g_obj ) );
    536536
    537537                $e1 = new BPTest_Group_Extension_Access_Anyone();
     
    580580                $gm->promote( 'admin' );
    581581
    582                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     582                $this->go_to( bp_get_group_url( $g_obj ) );
    583583
    584584                $e1 = new BPTest_Group_Extension_Access_Anyone();
     
    622622                $this->set_current_user( 0 );
    623623
    624                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     624                $this->go_to( bp_get_group_url( $g_obj ) );
    625625
    626626                $e1 = new BPTest_Group_Extension_Access_Anyone();
     
    664664                $this->set_current_user( 0 );
    665665
    666                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     666                $this->go_to( bp_get_group_url( $g_obj ) );
    667667
    668668                $e1 = new BPTest_Group_Extension_ShowTab_Anyone();
     
    707707                $this->set_current_user( $u );
    708708
    709                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     709                $this->go_to( bp_get_group_url( $g_obj ) );
    710710
    711711                $e1 = new BPTest_Group_Extension_ShowTab_Anyone();
     
    752752                $this->add_user_to_group( $u, $g );
    753753
    754                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     754                $this->go_to( bp_get_group_url( $g_obj ) );
    755755
    756756                $e1 = new BPTest_Group_Extension_ShowTab_Anyone();
     
    799799                $gm->promote( 'mod' );
    800800
    801                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     801                $this->go_to( bp_get_group_url( $g_obj ) );
    802802
    803803                $e1 = new BPTest_Group_Extension_ShowTab_Anyone();
     
    846846                $gm->promote( 'admin' );
    847847
    848                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     848                $this->go_to( bp_get_group_url( $g_obj ) );
    849849
    850850                $e1 = new BPTest_Group_Extension_ShowTab_Anyone();
     
    885885                $g_obj = groups_get_group( $g );
    886886
    887                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     887                $this->go_to( bp_get_group_url( $g_obj ) );
    888888
    889889                $e1 = new BPTest_Group_Extension_Widget_Method();
     
    907907                $g_obj = groups_get_group( $g );
    908908
    909                 $this->go_to( trailingslashit( bp_get_group_permalink( $g_obj ) ) . 'members/' );
     909                $this->go_to(
     910                        bp_get_group_url(
     911                                $g_obj,
     912                                array(
     913                                        'single_item_component' => 'members',
     914                                )
     915                        )
     916                );
    910917
    911918                $e1 = new BPTest_Group_Extension_Widget_Method();
     
    939946                bp_register_group_extension( $f_class_name );
    940947
    941                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     948                $this->go_to( bp_get_group_url( $g_obj ) );
    942949                $nav = buddypress()->groups->nav->get_secondary( array(
    943950                        'parent_slug' => $g_obj->slug ,
  • trunk/tests/phpunit/testcases/groups/class-bp-groups-member.php

    r13436 r13437  
    259259                // In group context
    260260                $g_obj = groups_get_group( $g );
    261                 $this->go_to( bp_get_group_permalink( $g_obj ) );
     261                $this->go_to( bp_get_group_url( $g_obj ) );
    262262                groups_update_groupmeta( $g, 'invite_status', 'mods' );
    263263                $this->assertFalse( bp_groups_user_can_send_invites( null, $u_nonmembers ) );
  • trunk/tests/phpunit/testcases/groups/template.php

    r13414 r13437  
    66#[AllowDynamicProperties]
    77class BP_Tests_Groups_Template extends BP_UnitTestCase {
     8        protected $groups_template = null;
    89
    910        public function set_up() {
     
    10061007                $g   = $this->factory->group->create();
    10071008                $p   = 2;
    1008                 $url = trailingslashit( bp_get_group_permalink( $g ) . $p );
     1009                $url = bp_get_group_url(
     1010                        $g,
     1011                        array(
     1012                                'single_item_action' => $p,
     1013                        )
     1014                );
    10091015
    10101016                $this->assertSame( bp_get_group_form_action( $p, $g ), $url );
Note: See TracChangeset for help on using the changeset viewer.