Changeset 13437
- Timestamp:
- 03/18/2023 09:42:31 AM (19 months ago)
- Location:
- trunk
- Files:
-
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-template.php
r13436 r13437 1228 1228 if ( bp_is_active( 'groups' ) ) { 1229 1229 $group = groups_get_group( $item_id ); 1230 $link = bp_get_group_ permalink( $group );1230 $link = bp_get_group_url( $group ); 1231 1231 $name = $group->name; 1232 1232 } … … 1611 1611 1612 1612 $generated_content->group_url = array( 1613 'value' => bp_get_group_ permalink( $group ),1613 'value' => bp_get_group_url( $group ), 1614 1614 'sanitize_callback' => 'esc_url', 1615 1615 ); -
trunk/src/bp-core/deprecated/12.0.php
r13436 r13437 332 332 return apply_filters_deprecated( 'bp_get_blogs_directory_permalink', array( $url ), '12.0.0', 'bp_get_blogs_directory_url' ); 333 333 } 334 335 /** 336 * Outputs the group creation numbered steps navbar 337 * 338 * @since 3.0.0 339 * @deprecated 12.0.0 340 */ 341 function 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 44 44 $no_access_args = array( 45 45 '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 ), 47 47 'redirect' => false 48 48 ); -
trunk/src/bp-groups/actions/create.php
r13177 r13437 18 18 19 19 // 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' ) ) { 21 21 return false; 22 23 if ( !is_user_logged_in() ) 22 } 23 24 if ( ! is_user_logged_in() ) { 24 25 return false; 25 26 if ( !bp_user_can_create_groups() ) { 26 } 27 28 if ( ! bp_user_can_create_groups() ) { 27 29 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() ); 29 31 } 30 32 … … 199 201 do_action( 'groups_group_create_complete', $bp->groups->new_group_id ); 200 202 201 bp_core_redirect( bp_get_group_ permalink( $bp->groups->current_group ) );203 bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) ); 202 204 } else { 203 205 /** … … 314 316 function groups_action_sort_creation_steps() { 315 317 316 if ( ! bp_is_groups_component() || !bp_is_current_action( 'create' ) )318 if ( ! bp_is_groups_component() || ! bp_is_current_action( 'create' ) ) { 317 319 return false; 320 } 318 321 319 322 $bp = buddypress(); 320 323 321 if ( ! is_array( $bp->groups->group_creation_steps ) )324 if ( ! is_array( $bp->groups->group_creation_steps ) ) { 322 325 return false; 326 } 323 327 324 328 foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) { 325 while ( ! empty( $temp[$step['position']] ) )329 while ( ! empty( $temp[$step['position']] ) ) { 326 330 $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 ); 329 338 } 330 339 331 340 // 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 } 337 352 338 353 /** -
trunk/src/bp-groups/actions/feed.php
r12590 r13437 36 36 'title' => sprintf( _x( '%1$s | %2$s | Activity', 'Group activity RSS title', 'buddypress' ), bp_get_site_name(), bp_get_current_group_name() ), 37 37 38 'link' => bp_get_group_ permalink( $group ),38 'link' => bp_get_group_url( $group ), 39 39 40 40 /* translators: %s: Group Name. */ -
trunk/src/bp-groups/actions/join.php
r11971 r13437 33 33 if ( !groups_check_user_has_invite( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) { 34 34 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 ) ); 36 36 } 37 37 } … … 43 43 bp_core_add_message( __( 'You joined the group!', 'buddypress' ) ); 44 44 45 bp_core_redirect( bp_get_group_ permalink( $bp->groups->current_group ) );45 bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) ); 46 46 } 47 47 -
trunk/src/bp-groups/actions/leave-group.php
r12438 r13437 47 47 48 48 $group = groups_get_current_group(); 49 $redirect = bp_get_group_ permalink( $group );49 $redirect = bp_get_group_url( $group ); 50 50 51 51 if ( ! $group->is_visible ) { … … 78 78 * Remove invitations where the deleted user is the sender. 79 79 * We'll use groups_uninvite_user() so that notifications will be cleaned up. 80 */ 80 */ 81 81 $pending_invites = groups_get_invites( array( 82 82 'inviter_id' => $user_id, -
trunk/src/bp-groups/actions/random.php
r11923 r13437 18 18 $group = BP_Groups_Group::get_random( 1, 1 ); 19 19 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] ) ); 21 21 } 22 22 } -
trunk/src/bp-groups/bp-groups-activity.php
r13367 r13437 107 107 108 108 $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>'; 110 110 111 111 /* translators: 1: the user link. 2: the group link. */ … … 136 136 137 137 $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>'; 139 139 140 140 /* translators: 1: the user link. 2: the group link. */ … … 176 176 177 177 $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>'; 179 179 180 180 /* … … 233 233 $group = bp_groups_get_activity_group( $activity->item_id ); 234 234 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>'; 236 236 237 237 // Set the Activity update posted in a Group action. … … 770 770 * @param int $group_id ID of the group. Passed by reference. 771 771 */ 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 ) ); 773 773 774 774 // Record in activity streams. -
trunk/src/bp-groups/bp-groups-admin.php
r13433 r13437 639 639 $form_url = remove_query_arg( array( 'action', 'deleted', 'no_admins', 'error', 'error_new', 'success_new', 'error_modified', 'success_modified' ), $_SERVER['REQUEST_URI'] ); 640 640 $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 ); 641 646 642 647 /** … … 655 660 656 661 <?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> 658 663 <?php endif; ?> 659 664 … … 684 689 <strong><?php esc_html_e( 'Permalink:', 'buddypress' ) ?></strong> 685 690 <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"> / 687 692 </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> 689 694 </div> 690 695 … … 814 819 // Prepare the group items for display. 815 820 $bp_groups_list_table->prepare_items(); 821 $create_url = bp_get_groups_directory_url( 822 array( 823 'create_single_item' => 1, 824 ) 825 ); 816 826 817 827 /** … … 831 841 832 842 <?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> 834 844 <?php endif; ?> 835 845 -
trunk/src/bp-groups/bp-groups-adminbar.php
r13395 r13437 46 46 'id' => $bp->group_admin_menu_id, 47 47 'title' => __( 'Edit Group', 'buddypress' ), 48 'href' => bp_get_group_ permalink( $bp->groups->current_group )48 'href' => bp_get_group_url( $bp->groups->current_group ) 49 49 ) ); 50 50 -
trunk/src/bp-groups/bp-groups-blocks.php
r13296 r13437 61 61 // Group name/link/description variables. 62 62 $group_name = bp_get_group_name( $group ); 63 $group_link = bp_get_group_ permalink( $group );63 $group_link = bp_get_group_url( $group ); 64 64 $group_description = ''; 65 65 $group_content = ''; … … 235 235 236 236 // Get Member link. 237 $group_link = bp_get_group_ permalink( $group );237 $group_link = bp_get_group_url( $group ); 238 238 239 239 // Set the Avatar output. … … 384 384 // Make sure the widget ID is unique. 385 385 $widget_id = uniqid( 'groups-list-' ); 386 $groups_directory_link = bp_get_groups_directory_ permalink();386 $groups_directory_link = bp_get_groups_directory_url(); 387 387 388 388 // Set the Block's title. … … 465 465 'php', 466 466 array( 467 'data.link' => bp_get_group_ permalink( $group ),467 'data.link' => bp_get_group_url( $group ), 468 468 'data.name' => bp_get_group_name( $group ), 469 469 'data.avatar_urls.thumb' => bp_core_fetch_avatar( -
trunk/src/bp-groups/bp-groups-filters.php
r12906 r13437 34 34 35 35 add_filter( 'bp_get_group_name', 'wp_filter_kses', 1 ); 36 add_filter( 'bp_get_group_ permalink','wp_filter_kses', 1 );36 add_filter( 'bp_get_group_url', 'wp_filter_kses', 1 ); 37 37 add_filter( 'bp_get_group_description', 'bp_groups_filter_kses', 1 ); 38 38 add_filter( 'bp_get_group_description_excerpt', 'wp_filter_kses', 1 ); -
trunk/src/bp-groups/bp-groups-functions.php
r13395 r13437 3334 3334 array( 3335 3335 'name' => __( 'Group URL', 'buddypress' ), 3336 'value' => bp_get_group_ permalink( $group ),3336 'value' => bp_get_group_url( $group ), 3337 3337 ), 3338 3338 ); … … 3423 3423 array( 3424 3424 'name' => __( 'Group URL', 'buddypress' ), 3425 'value' => bp_get_group_ permalink( $group ),3425 'value' => bp_get_group_url( $group ), 3426 3426 ), 3427 3427 array( … … 3489 3489 array( 3490 3490 'name' => __( 'Group URL', 'buddypress' ), 3491 'value' => bp_get_group_ permalink( $group ),3491 'value' => bp_get_group_url( $group ), 3492 3492 ), 3493 3493 array( … … 3559 3559 array( 3560 3560 'name' => __( 'Group URL', 'buddypress' ), 3561 'value' => bp_get_group_ permalink( $group ),3561 'value' => bp_get_group_url( $group ), 3562 3562 ), 3563 3563 array( … … 3725 3725 } 3726 3726 } 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 */ 3735 function 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 */ 3760 function 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 */ 3796 function 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 52 52 /* translators: 1: the old group permalink. 2: the new group permalink. */ 53 53 _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 ) ) 56 56 ); 57 57 } … … 90 90 'group' => $group, 91 91 'group.id' => $group_id, 92 'group.url' => esc_url( bp_get_group_ permalink( $group ) ),92 'group.url' => esc_url( bp_get_group_url( $group ) ), 93 93 'group.name' => $group->name, 94 94 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ), … … 216 216 'group.id' => $group_id, 217 217 'group.name' => $group->name, 218 'group.url' => esc_url( bp_get_group_ permalink( $group ) ),218 'group.url' => esc_url( bp_get_group_url( $group ) ), 219 219 'requesting-user.id' => $requesting_user_id, 220 220 ), … … 291 291 'group' => $group, 292 292 'group.id' => $group_id, 293 'group.url' => esc_url( bp_get_group_ permalink( $group ) ),293 'group.url' => esc_url( bp_get_group_url( $group ) ), 294 294 'group.name' => $group->name, 295 295 'promoted_to' => $promoted_to, … … 363 363 'tokens' => array( 364 364 'group' => $group, 365 'group.url' => bp_get_group_permalink( $group),365 'group.url' => esc_url( bp_get_group_url( $group ) ), 366 366 'group.name' => $group->name, 367 367 'inviter.name' => bp_core_get_userlink( $inviter_user_id, true, false ), … … 397 397 switch ( $action ) { 398 398 case 'new_membership_request': 399 $group_id = $item_id;399 $group_id = $item_id; 400 400 $requesting_user_id = $secondary_item_id; 401 401 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 */ 409 411 if ( (int) $total_items > 1 ) { 410 412 /* 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 ); 414 427 415 428 if ( 'string' == $format ) { … … 430 443 * @param string $notification_link The permalink for notification. 431 444 */ 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 ); 433 446 } else { 434 447 … … 455 468 } else { 456 469 $user_fullname = bp_core_get_user_displayname( $requesting_user_id ); 470 457 471 /* 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 ); 460 485 461 486 if ( 'string' == $format ) { … … 476 501 * @param string $notification_link The permalink for notification. 477 502 */ 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 ); 479 504 } else { 480 505 … … 506 531 $group_id = $item_id; 507 532 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'; 511 536 512 537 if ( (int) $total_items > 1 ) { 513 538 /* 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'; 516 541 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 517 542 … … 530 555 * @param string $notification_link The permalink for notification. 531 556 */ 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 ); 533 558 } else { 534 559 … … 552 577 } else { 553 578 /* 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 ); 557 582 558 583 if ( 'string' == $format ) { … … 570 595 * @param string $notification_link The permalink for notification. 571 596 */ 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 ); 573 598 } else { 574 599 … … 597 622 $group_id = $item_id; 598 623 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'; 602 627 603 628 if ( (int) $total_items > 1 ) { 604 629 /* 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'; 607 632 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 608 633 … … 621 646 * @param string $notification_link The permalink for notification. 622 647 */ 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 ); 624 649 } else { 625 650 … … 643 668 } else { 644 669 /* 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 ); 647 672 648 673 if ( 'string' == $format ) { … … 660 685 * @param string $notification_link The permalink for notification. 661 686 */ 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 ); 663 688 } else { 664 689 … … 687 712 $group_id = $item_id; 688 713 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'; 692 717 693 718 if ( (int) $total_items > 1 ) { 694 719 /* 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'; 697 722 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 698 723 … … 709 734 * @param string $notification_link The permalink for notification. 710 735 */ 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 ); 712 737 } else { 713 738 /** … … 729 754 } else { 730 755 /* 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 ); 733 758 734 759 if ( 'string' == $format ) { … … 745 770 * @param string $notification_link The permalink for notification. 746 771 */ 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 ); 748 773 } else { 749 774 /** … … 771 796 $group_id = $item_id; 772 797 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'; 776 801 777 802 if ( (int) $total_items > 1 ) { 778 803 /* 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'; 781 806 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; 782 807 … … 793 818 * @param string $notification_link The permalink for notification. 794 819 */ 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 ); 796 821 } else { 797 822 /** … … 813 838 } else { 814 839 /* 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 ); 817 842 818 843 if ( 'string' == $format ) { … … 829 854 * @param string $notification_link The permalink for notification. 830 855 */ 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 ); 832 857 } else { 833 858 /** … … 853 878 854 879 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'; 859 884 860 885 $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1'; … … 897 922 } else { 898 923 /* 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 ); 900 925 $filter = 'bp_groups_single_group_invite_notification'; 901 926 … … 913 938 * @param string $notification_link The permalink for notification. 914 939 */ 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 ); 916 941 } else { 917 942 /** … … 1257 1282 'group.id' => $group_id, 1258 1283 'group.name' => $group->name, 1259 'group.url' => esc_url( bp_get_group_ permalink( $group ) ),1284 'group.url' => esc_url( bp_get_group_url( $group ) ), 1260 1285 'leave-group.url' => esc_url( 1261 1286 bp_members_get_user_url( -
trunk/src/bp-groups/bp-groups-template.php
r13436 r13437 118 118 */ 119 119 function 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 ); 121 121 122 122 $path_chunks = bp_parse_args( … … 1237 1237 1238 1238 /** 1239 * Output the permalinkfor the group.1240 * 1241 * @since 1 .0.01239 * Output the URL for the group. 1240 * 1241 * @since 12.0.0 1242 1242 * 1243 1243 * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. 1244 1244 * Default: false. 1245 1245 */ 1246 function 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 */ 1265 function 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 */ 1246 1316 function 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 ); 1248 1319 } 1249 1320 /** … … 1258 1329 */ 1259 1330 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 ); 1265 1346 1266 1347 /** … … 1269 1350 * @since 1.0.0 1270 1351 * @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' ); 1276 1358 } 1277 1359 … … 1306 1388 $link = sprintf( 1307 1389 '<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 ) ), 1309 1391 esc_attr( bp_get_group_slug( $group ) ), 1310 1392 esc_html( bp_get_group_name( $group ) ) … … 3199 3281 } 3200 3282 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 3201 3295 /** 3202 3296 * Filters the 'action' attribute for a group form. … … 3205 3299 * @since 2.5.0 Added the `$group` parameter. 3206 3300 * 3207 * @param string $ valueAction attribute for a group form.3301 * @param string $url Action attribute for a group form. 3208 3302 * @param BP_Groups_Group $group The group object. 3209 3303 * @param int|string|bool $page Page slug. 3210 3304 */ 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 ); 3212 3306 } 3213 3307 … … 3559 3653 * @param object $group Group object. 3560 3654 */ 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 ); 3562 3656 } 3563 3657 … … 3719 3813 'wrapper_class' => 'group-button ' . $group->status, 3720 3814 '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 ) ), 3722 3816 'link_text' => __( 'Accept Invitation', 'buddypress' ), 3723 3817 'link_title' => __( 'Accept Invitation', 'buddypress' ), … … 3735 3829 'wrapper_class' => 'group-button pending ' . $group->status, 3736 3830 'wrapper_id' => 'groupbutton-' . $group->id, 3737 'link_href' => bp_get_group_ permalink( $group ),3831 'link_href' => bp_get_group_url( $group ), 3738 3832 'link_text' => __( 'Request Sent', 'buddypress' ), 3739 3833 'link_title' => __( 'Request Sent', 'buddypress' ), … … 3828 3922 'link_text' => __( 'Create a Group', 'buddypress' ), 3829 3923 '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 ), 3831 3929 'wrapper' => false, 3832 3930 'block_self' => false, … … 4890 4988 4891 4989 /** 4892 * @since 1.0.04893 * 4894 * @ return bool4990 * Outputs the Group creation tabs. 4991 * 4992 * @since 1.0.0 4895 4993 */ 4896 4994 function 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 ) ) { 4900 4999 return false; 4901 5000 } 4902 5001 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 ); 4905 5004 $bp->groups->current_create_step = array_shift( $keys ); 4906 5005 } … … 4908 5007 $counter = 1; 4909 5008 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 ); 4914 5035 $counter++; 4915 } 4916 4917 unset( $is_enabled ); 5036 unset( $is_enabled ); 5037 } 4918 5038 4919 5039 /** … … 4954 5074 */ 4955 5075 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 ); 4960 5082 $bp->action_variables[1] = array_shift( $keys ); 4961 5083 } 4962 5084 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 4963 5098 /** 4964 5099 * Filters the group creation form action. … … 4966 5101 * @since 1.1.0 4967 5102 * 4968 * @param string $ valueAction 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 ); 4971 5106 } 4972 5107 … … 5298 5433 */ 5299 5434 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 = ''; 5302 5438 5303 5439 // Loop through steps. … … 5314 5450 5315 5451 // 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 } 5320 5465 5321 5466 /** … … 6582 6727 $url = bp_get_group_permalink( $current_group ) . $action; 6583 6728 } else { 6584 $url = bp_get_group_ permalink( $current_group );6729 $url = bp_get_group_url( $current_group ); 6585 6730 } 6586 6731 -
trunk/src/bp-groups/bp-groups-widgets.php
r13153 r13437 68 68 <li <?php bp_group_class(); ?>> 69 69 <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> 71 71 </div> 72 72 -
trunk/src/bp-groups/classes/class-bp-group-extension.php
r13399 r13437 731 731 732 732 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() ); 734 734 735 735 bp_core_create_subnav_link( array( … … 750 750 751 751 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() ); 753 753 754 754 bp_core_register_subnav_screen_function( array( -
trunk/src/bp-groups/classes/class-bp-groups-component.php
r13432 r13437 375 375 376 376 // 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. 389 380 $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'] ); 410 393 } 411 394 … … 415 398 * @since 1.1.0 416 399 * 417 * @param array $ valueArray of preconfigured group creation steps.400 * @param array $group_creation_steps Array of preconfigured group creation steps. 418 401 */ 419 402 $this->group_creation_steps = apply_filters( 'groups_create_group_steps', $group_creation_steps ); … … 542 525 543 526 // 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 ); 545 528 546 529 if ( bp_current_action() ) { … … 670 653 ), 'groups' ); 671 654 672 $group_link = bp_get_group_ permalink( $this->current_group );655 $group_link = bp_get_group_url( $this->current_group ); 673 656 674 657 // Add the "Home" subnav item, as this will always be present. … … 919 902 'id' => 'my-account-' . $this->id . '-create', 920 903 '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 ), 922 909 'position' => 90 923 910 ); … … 1009 996 // Just let BP Component fire 'bp_groups_register_taxonomies'. 1010 997 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 ); 1011 1048 } 1012 1049 -
trunk/src/bp-groups/classes/class-bp-groups-list-table.php
r13147 r13437 589 589 $delete_url = wp_nonce_url( $base_url . "&action=delete", 'bp-groups-delete' ); 590 590 $edit_url = $base_url . '&action=edit'; 591 $view_url = bp_get_group_ permalink( $item_obj );591 $view_url = bp_get_group_url( $item_obj ); 592 592 593 593 /** -
trunk/src/bp-groups/classes/class-bp-groups-widget.php
r13108 r13437 101 101 echo $before_widget; 102 102 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; 104 104 105 105 echo $before_title . $title . $after_title; … … 126 126 <?php if ( bp_has_groups( $group_args ) ) : ?> 127 127 <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> 129 129 <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> 131 131 <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> 133 133 <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> 135 135 </div> 136 136 … … 139 139 <li <?php bp_group_class(); ?>> 140 140 <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> 142 142 </div> 143 143 -
trunk/src/bp-groups/screens/single/request-membership.php
r12719 r13437 33 33 } 34 34 35 bp_core_redirect( bp_get_group_ permalink( $bp->groups->current_group ) );35 bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) ); 36 36 } 37 37 … … 60 60 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' ) ); 61 61 } 62 bp_core_redirect( bp_get_group_ permalink( $bp->groups->current_group ) );62 bp_core_redirect( bp_get_group_url( $bp->groups->current_group ) ); 63 63 } 64 64 -
trunk/src/bp-groups/screens/single/send-invites.php
r12433 r13437 43 43 */ 44 44 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 ) ); 46 46 47 47 } elseif ( !bp_action_variable( 0 ) ) { -
trunk/src/bp-members/classes/class-bp-members-component.php
r13436 r13437 788 788 789 789 /** 790 * Add theRegistration and Activation rewrite tags.790 * Adds the Members directory type, Registration and Activation rewrite tags. 791 791 * 792 792 * @since 12.0.0 … … 797 797 public function add_rewrite_tags( $rewrite_tags = array() ) { 798 798 $rewrite_tags = array( 799 'directory_type' => '([^/]+)', 799 800 'member_register' => '([1]{1,})', 800 801 'member_activate' => '([1]{1,})', … … 806 807 807 808 /** 808 * Add the Registration and Activation rewrite rules.809 * Adds the Registration and Activation rewrite rules. 809 810 * 810 811 * @since 12.0.0 … … 841 842 842 843 /** 843 * Add the Registration and Activation permastructs.844 * Adds the Registration and Activation permastructs. 844 845 * 845 846 * @since 12.0.0 -
trunk/src/bp-templates/bp-legacy/buddypress-functions.php
r13395 r13437 1608 1608 _e( 'Error requesting membership', 'buddypress' ); 1609 1609 } 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>'; 1611 1611 } 1612 1612 break; -
trunk/src/bp-templates/bp-legacy/buddypress/groups/groups-loop.php
r12791 r13437 7 7 * @package BuddyPress 8 8 * @subpackage bp-legacy 9 * @version 3.0.09 * @version 12.0.0 10 10 */ 11 11 … … 59 59 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?> 60 60 <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> 62 62 </div> 63 63 <?php endif; ?> -
trunk/src/bp-templates/bp-legacy/buddypress/groups/index.php
r12595 r13437 5 5 * @package BuddyPress 6 6 * @subpackage bp-legacy 7 * @version 3.0.07 * @version 12.0.0 8 8 */ 9 9 … … 61 61 <ul> 62 62 <li class="selected" id="groups-all"> 63 <a href="<?php bp_groups_directory_ permalink(); ?>">63 <a href="<?php bp_groups_directory_url(); ?>"> 64 64 <?php 65 65 /* translators: %s: all groups count */ -
trunk/src/bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php
r12791 r13437 5 5 * @package BuddyPress 6 6 * @subpackage bp-legacy 7 * @version 3.0.07 * @version 12.0.0 8 8 */ 9 9 … … 16 16 17 17 <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> 19 19 20 20 <div id="item-header-cover-image"> 21 21 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?> 22 22 <div id="item-header-avatar"> 23 <a href="<?php echo esc_url( bp_get_group_permalink()); ?>">23 <a href="<?php bp_group_url(); ?>"> 24 24 25 25 <?php bp_group_avatar(); ?> -
trunk/src/bp-templates/bp-legacy/buddypress/groups/single/group-header.php
r12791 r13437 5 5 * @package BuddyPress 6 6 * @subpackage bp-legacy 7 * @version 3.0.07 * @version 12.0.0 8 8 */ 9 9 … … 60 60 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?> 61 61 <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() ); ?>"> 63 63 64 64 <?php bp_group_avatar(); ?> -
trunk/src/bp-templates/bp-legacy/buddypress/members/single/groups/invites.php
r13273 r13437 5 5 * @package BuddyPress 6 6 * @subpackage bp-legacy 7 * @version 1 1.0.07 * @version 12.0.0 8 8 */ 9 9 … … 29 29 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?> 30 30 <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> 32 32 </div> 33 33 <?php endif; ?> -
trunk/src/bp-templates/bp-nouveau/buddypress/groups/groups-loop.php
r12791 r13437 4 4 * 5 5 * @since 3.0.0 6 * @version 7.0.06 * @version 12.0.0 7 7 */ 8 8 … … 26 26 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?> 27 27 <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> 29 29 </div> 30 30 <?php endif; ?> -
trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/cover-image-header.php
r12801 r13437 4 4 * 5 5 * @since 3.0.0 6 * @version 7.0.06 * @version 12.0.0 7 7 */ 8 8 ?> … … 14 14 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?> 15 15 <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() ); ?>"> 17 17 18 18 <?php bp_group_avatar(); ?> -
trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/group-header.php
r12801 r13437 4 4 * 5 5 * @since 3.0.0 6 * @version 7.0.06 * @version 12.0.0 7 7 */ 8 8 ?> … … 12 12 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?> 13 13 <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() ); ?>"> 15 15 16 16 <?php bp_group_avatar(); ?> -
trunk/src/bp-templates/bp-nouveau/buddypress/members/single/groups/invites.php
r13273 r13437 4 4 * 5 5 * @since 3.0.0 6 * @version 1 1.0.06 * @version 12.0.0 7 7 */ 8 8 ?> … … 27 27 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?> 28 28 <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> 30 30 </div> 31 31 <?php endif; ?> -
trunk/src/bp-templates/bp-nouveau/includes/groups/functions.php
r13433 r13437 562 562 'slug' => 'all', // slug is used because BP_Core_Nav requires it, but it's the scope 563 563 'li_class' => array( 'selected' ), 564 'link' => bp_get_groups_directory_ permalink(),564 'link' => bp_get_groups_directory_url(), 565 565 'text' => __( 'All Groups', 'buddypress' ), 566 566 'count' => bp_get_total_group_count(), … … 591 591 'slug' => 'create', // slug is used because BP_Core_Nav requires it, but it's the scope 592 592 '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 ), 594 598 'text' => __( 'Create a Group', 'buddypress' ), 595 599 'count' => false, -
trunk/src/bp-templates/bp-nouveau/includes/groups/template-tags.php
r13310 r13437 251 251 252 252 return (int) bp_get_user_meta( $user_id, '_bp_nouveau_restrict_invites_to_friends' ); 253 }254 255 /**256 * Outputs the group creation numbered steps navbar257 *258 * @since 3.0.0259 *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 <?php289 $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.0298 */299 do_action( 'groups_creation_tabs' );300 253 } 301 254 -
trunk/src/bp-templates/bp-nouveau/includes/template-tags.php
r13433 r13437 2264 2264 2265 2265 } 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() ) ); 2267 2267 2268 2268 } elseif ( ! empty( $r['object'] ) && ! empty( $r['item_id'] ) ) { … … 2274 2274 2275 2275 if ( ! empty( $group->id ) ) { 2276 $url = rawurlencode( bp_get_group_ permalink( $group ) );2276 $url = rawurlencode( bp_get_group_url( $group ) ); 2277 2277 } 2278 2278 } -
trunk/tests/phpunit/testcases/core/nav/backCompat.php
r13436 r13437 55 55 56 56 $group = groups_get_group( $g ); 57 $group_permalink = bp_get_group_ permalink( $group );57 $group_permalink = bp_get_group_url( $group ); 58 58 59 59 $this->go_to( $group_permalink ); … … 303 303 'slug' => 'foo-subnav', 304 304 '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() ), 306 306 'screen_function' => 'foo_subnav', 307 307 ) ); -
trunk/tests/phpunit/testcases/core/nav/bpCoreMaybeHookNewSubnavScreenFunction.php
r13436 r13437 171 171 $old_current_user = get_current_user_id(); 172 172 $this->set_current_user( $u ); 173 $this->set_permalink_structure( '/%postname%/' ); 173 174 174 175 $group = groups_get_group( $g ); 175 176 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'] ); 187 188 188 189 // Clean up … … 198 199 $group = groups_get_group( $g ); 199 200 200 $this->go_to( bp_get_group_ permalink( $group ) );201 $this->go_to( bp_get_group_url( $group ) ); 201 202 202 203 $subnav_item = array( -
trunk/tests/phpunit/testcases/core/nav/bpCoreNewNavItem.php
r13436 r13437 78 78 $group = groups_get_group( $g ); 79 79 80 $this->go_to( bp_get_group_ permalink( $group ) );80 $this->go_to( bp_get_group_url( $group ) ); 81 81 82 82 $this->assertTrue( buddypress()->bp_nav[ $group->slug ]['position'] === -1 ); -
trunk/tests/phpunit/testcases/core/nav/bpCoreRemoveSubnavItem.php
r11737 r13437 77 77 // In group context 78 78 $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 ) ); 80 80 81 81 bp_core_new_subnav_item( array( … … 83 83 'slug' => 'clam', 84 84 '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 ), 86 86 'screen_function' => 'clam_subnav', 87 87 ) ); -
trunk/tests/phpunit/testcases/groups/activity.php
r12395 r13437 25 25 $g_obj = groups_get_group( $g ); 26 26 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>' ); 28 28 29 29 $this->assertSame( $expected, $a_obj->action ); … … 47 47 $g_obj = groups_get_group( $g ); 48 48 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>' ); 50 50 51 51 $this->assertSame( $expected, $a_obj->action ); … … 124 124 $this->assertNotEmpty( $a['activities'] ); 125 125 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' ); 127 127 $this->assertSame( $expected, $a['activities'][0]->action ); 128 128 … … 156 156 $this->assertNotEmpty( $a['activities'] ); 157 157 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' ); 159 159 $this->assertSame( $expected, $a['activities'][0]->action ); 160 160 … … 189 189 $this->assertNotEmpty( $a['activities'] ); 190 190 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>' ); 192 192 $this->assertSame( $expected, $a['activities'][0]->action ); 193 193 … … 221 221 $this->assertNotEmpty( $a['activities'] ); 222 222 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>' ); 224 224 $this->assertSame( $expected, $a['activities'][0]->action ); 225 225 … … 244 244 $g_obj = groups_get_group( $g ); 245 245 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>' ); 247 247 248 248 $this->assertSame( $expected, $a_obj->action ); -
trunk/tests/phpunit/testcases/groups/class-bp-group-extension.php
r13436 r13437 242 242 $e = new $class_name(); 243 243 244 $this->go_to( bp_get_group_ permalink( $g_obj ) );244 $this->go_to( bp_get_group_url( $g_obj ) ); 245 245 246 246 $e->_register(); … … 266 266 $e = new $class_name(); 267 267 268 $this->go_to( bp_get_group_ permalink( $g_obj ) );268 $this->go_to( bp_get_group_url( $g_obj ) ); 269 269 270 270 $e->_register(); … … 295 295 // Test as non-logged-in user 296 296 $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 ) ); 298 298 $e->_register(); 299 299 $this->assertFalse( isset( buddypress()->bp_options_nav[ $g_obj->slug ][ $e->slug ] ) ); … … 306 306 $this->set_current_user( $u ); 307 307 $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 ) ); 309 309 $e->_register(); 310 310 $this->assertTrue( isset( buddypress()->bp_options_nav[ $g_obj->slug ][ $e->slug ] ) ); … … 340 340 // Test as non-logged-in user 341 341 $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 ) ); 343 343 $e->_register(); 344 344 $this->assertTrue( isset( buddypress()->bp_options_nav[ $g_obj->slug ][ $e->slug ] ) ); … … 351 351 $this->set_current_user( $u ); 352 352 $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 ) ); 354 354 $e->_register(); 355 355 $this->assertTrue( isset( buddypress()->bp_options_nav[ $g_obj->slug ][ $e->slug ] ) ); … … 371 371 ) ); 372 372 $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 ) ); 374 374 375 375 $this->set_current_user( 0 ); … … 398 398 ) ); 399 399 $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 ) ); 401 401 402 402 $e1 = new BPTest_Group_Extension_Access_Anyone(); … … 441 441 $this->set_current_user( $u ); 442 442 443 $this->go_to( bp_get_group_ permalink( $g_obj ) );443 $this->go_to( bp_get_group_url( $g_obj ) ); 444 444 445 445 $e1 = new BPTest_Group_Extension_Access_Anyone(); … … 486 486 $this->add_user_to_group( $u, $g ); 487 487 488 $this->go_to( bp_get_group_ permalink( $g_obj ) );488 $this->go_to( bp_get_group_url( $g_obj ) ); 489 489 490 490 $e1 = new BPTest_Group_Extension_Access_Anyone(); … … 533 533 $gm->promote( 'mod' ); 534 534 535 $this->go_to( bp_get_group_ permalink( $g_obj ) );535 $this->go_to( bp_get_group_url( $g_obj ) ); 536 536 537 537 $e1 = new BPTest_Group_Extension_Access_Anyone(); … … 580 580 $gm->promote( 'admin' ); 581 581 582 $this->go_to( bp_get_group_ permalink( $g_obj ) );582 $this->go_to( bp_get_group_url( $g_obj ) ); 583 583 584 584 $e1 = new BPTest_Group_Extension_Access_Anyone(); … … 622 622 $this->set_current_user( 0 ); 623 623 624 $this->go_to( bp_get_group_ permalink( $g_obj ) );624 $this->go_to( bp_get_group_url( $g_obj ) ); 625 625 626 626 $e1 = new BPTest_Group_Extension_Access_Anyone(); … … 664 664 $this->set_current_user( 0 ); 665 665 666 $this->go_to( bp_get_group_ permalink( $g_obj ) );666 $this->go_to( bp_get_group_url( $g_obj ) ); 667 667 668 668 $e1 = new BPTest_Group_Extension_ShowTab_Anyone(); … … 707 707 $this->set_current_user( $u ); 708 708 709 $this->go_to( bp_get_group_ permalink( $g_obj ) );709 $this->go_to( bp_get_group_url( $g_obj ) ); 710 710 711 711 $e1 = new BPTest_Group_Extension_ShowTab_Anyone(); … … 752 752 $this->add_user_to_group( $u, $g ); 753 753 754 $this->go_to( bp_get_group_ permalink( $g_obj ) );754 $this->go_to( bp_get_group_url( $g_obj ) ); 755 755 756 756 $e1 = new BPTest_Group_Extension_ShowTab_Anyone(); … … 799 799 $gm->promote( 'mod' ); 800 800 801 $this->go_to( bp_get_group_ permalink( $g_obj ) );801 $this->go_to( bp_get_group_url( $g_obj ) ); 802 802 803 803 $e1 = new BPTest_Group_Extension_ShowTab_Anyone(); … … 846 846 $gm->promote( 'admin' ); 847 847 848 $this->go_to( bp_get_group_ permalink( $g_obj ) );848 $this->go_to( bp_get_group_url( $g_obj ) ); 849 849 850 850 $e1 = new BPTest_Group_Extension_ShowTab_Anyone(); … … 885 885 $g_obj = groups_get_group( $g ); 886 886 887 $this->go_to( bp_get_group_ permalink( $g_obj ) );887 $this->go_to( bp_get_group_url( $g_obj ) ); 888 888 889 889 $e1 = new BPTest_Group_Extension_Widget_Method(); … … 907 907 $g_obj = groups_get_group( $g ); 908 908 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 ); 910 917 911 918 $e1 = new BPTest_Group_Extension_Widget_Method(); … … 939 946 bp_register_group_extension( $f_class_name ); 940 947 941 $this->go_to( bp_get_group_ permalink( $g_obj ) );948 $this->go_to( bp_get_group_url( $g_obj ) ); 942 949 $nav = buddypress()->groups->nav->get_secondary( array( 943 950 'parent_slug' => $g_obj->slug , -
trunk/tests/phpunit/testcases/groups/class-bp-groups-member.php
r13436 r13437 259 259 // In group context 260 260 $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 ) ); 262 262 groups_update_groupmeta( $g, 'invite_status', 'mods' ); 263 263 $this->assertFalse( bp_groups_user_can_send_invites( null, $u_nonmembers ) ); -
trunk/tests/phpunit/testcases/groups/template.php
r13414 r13437 6 6 #[AllowDynamicProperties] 7 7 class BP_Tests_Groups_Template extends BP_UnitTestCase { 8 protected $groups_template = null; 8 9 9 10 public function set_up() { … … 1006 1007 $g = $this->factory->group->create(); 1007 1008 $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 ); 1009 1015 1010 1016 $this->assertSame( bp_get_group_form_action( $p, $g ), $url );
Note: See TracChangeset
for help on using the changeset viewer.