Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/18/2023 09:42:31 AM (22 months 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.