Skip to:
Content

BuddyPress.org

Changeset 9466


Ignore:
Timestamp:
02/09/2015 11:34:12 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Replace all references to bp_get_root_domain() . '/' . bp_get_groups_root_slug() with the appropriate bp_get_groups_directory_permalink() function. This ensures all usages and filters are applied uniformly. See #4954 for the long-game here.

Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/bp-core/deprecated/2.1.php

    r9458 r9466  
    344344            <?php if ( bp_is_active( 'groups' ) ) : ?>
    345345
    346                 <li class="alt"><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) . '?random-group' ?>"  rel="nofollow"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>
     346                <li class="alt"><a href="<?php bp_groups_directory_permalink(); ?>?random-group"  rel="nofollow"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>
    347347
    348348            <?php endif; ?>
  • TabularUnified trunk/src/bp-forums/bp-forums-template.php

    r9383 r9466  
    10091009
    10101010        // Currently this will only work with group forums, extended support in the future
    1011         if ( bp_is_active( 'groups' ) )
    1012             $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_the_topic_object_slug() . '/forum' );
    1013         else
     1011        if ( bp_is_active( 'groups' ) ) {
     1012            $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_get_the_topic_object_slug() . '/forum' );
     1013        } else {
    10141014            $permalink = '';
     1015        }
    10151016
    10161017        /**
     
    14261427     */
    14271428    function bp_get_the_topic_permalink() {
    1428         global $forum_template, $bp;
     1429        global $forum_template;
    14291430
    14301431        // The topic is in a loop where its parent object is loaded
    14311432        if ( bp_get_the_topic_object_slug() ) {
    1432             $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_the_topic_object_slug() . '/forum' );
     1433            $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_get_the_topic_object_slug() . '/forum' );
    14331434
    14341435        // We are viewing a single group topic, so use the current item
    14351436        } elseif ( bp_is_group_forum_topic() ) {
    1436             $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/forum' );
     1437            $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_current_item() . '/forum' );
    14371438
    14381439        // We are unsure what the context is, so fallback to forum root slug
     
    27122713     */
    27132714    function bp_get_forum_permalink( $forum_id = 0 ) {
    2714         global $bp;
    27152715
    27162716        if ( bp_is_groups_component() ) {
    2717             $permalink = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/forum' );
     2717            $permalink = trailingslashit( bp_get_groups_directory_permalink() . bp_current_item() . '/forum' );
    27182718        } else {
    27192719            if ( empty( $forum_id ) ) {
  • TabularUnified trunk/src/bp-groups/bp-groups-actions.php

    r9451 r9466  
    107107    if ( !bp_user_can_create_groups() ) {
    108108        bp_core_add_message( __( 'Sorry, you are not allowed to create groups.', 'buddypress' ), 'error' );
    109         bp_core_redirect( trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) );
     109        bp_core_redirect( bp_get_groups_directory_permalink() );
    110110    }
    111111
     
    124124        $reset_steps = true;
    125125        $keys        = array_keys( $bp->groups->group_creation_steps );
    126         bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . array_shift( $keys ) . '/' );
     126        bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . array_shift( $keys ) ) );
    127127    }
    128128
     
    130130    if ( bp_get_groups_current_create_step() && empty( $bp->groups->group_creation_steps[bp_get_groups_current_create_step()] ) ) {
    131131        bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' );
    132         bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/' );
     132        bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create' ) );
    133133    }
    134134
     
    145145        if ( ! bp_is_group_creator( $bp->groups->current_group, bp_loggedin_user_id() ) ) {
    146146            bp_core_add_message( __( 'Only the group creator may continue editing this group.', 'buddypress' ), 'error' );
    147             bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/' );
     147            bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create' ) );
    148148        }
    149149    }
     
    158158            if ( empty( $_POST['group-name'] ) || empty( $_POST['group-desc'] ) || !strlen( trim( $_POST['group-name'] ) ) || !strlen( trim( $_POST['group-desc'] ) ) ) {
    159159                bp_core_add_message( __( 'Please fill in all of the required fields', 'buddypress' ), 'error' );
    160                 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' );
     160                bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) );
    161161            }
    162162
     
    165165            if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) {
    166166                bp_core_add_message( __( 'There was an error saving group details. Please try again.', 'buddypress' ), 'error' );
    167                 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' );
     167                bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) );
    168168            }
    169169        }
     
    189189            if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum ) ) ) {
    190190                bp_core_add_message( __( 'There was an error saving group details. Please try again.', 'buddypress' ), 'error' );
    191                 bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/' );
     191                bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) );
    192192            }
    193193
     
    295295            }
    296296
    297             bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . $next_step . '/' );
     297            bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . $next_step ) );
    298298        }
    299299    }
     
    314314
    315315        bp_core_add_message( $message, $error );
    316         bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/group-invites/' );
     316        bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/group-invites' ) );
    317317    }
    318318
     
    488488        $group = BP_Groups_Group::get_random( 1, 1 );
    489489
    490         bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group['groups'][0]->slug . '/' );
     490        bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . $group['groups'][0]->slug ) );
    491491    }
    492492}
  • TabularUnified trunk/src/bp-groups/bp-groups-admin.php

    r9351 r9466  
    524524
    525525            <?php if ( is_user_logged_in() && bp_user_can_create_groups() ) : ?>
    526                 <a class="add-new-h2" href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create' ); ?>"><?php _e( 'Add New', 'buddypress' ); ?></a>
     526                <a class="add-new-h2" href="<?php echo trailingslashit( bp_get_groups_directory_permalink() . 'create' ); ?>"><?php _e( 'Add New', 'buddypress' ); ?></a>
    527527            <?php endif; ?>
    528528
     
    671671
    672672            <?php if ( is_user_logged_in() && bp_user_can_create_groups() ) : ?>
    673                 <a class="add-new-h2" href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create' ); ?>"><?php _e( 'Add New', 'buddypress' ); ?></a>
     673                <a class="add-new-h2" href="<?php echo trailingslashit( bp_get_groups_directory_permalink() . 'create' ); ?>"><?php _e( 'Add New', 'buddypress' ); ?></a>
    674674            <?php endif; ?>
    675675
  • TabularUnified trunk/src/bp-groups/bp-groups-template.php

    r9465 r9466  
    925925        global $groups_template;
    926926
    927         if ( empty( $group ) )
     927        if ( empty( $group ) ) {
    928928            $group =& $groups_template->group;
    929 
    930         return apply_filters( 'bp_get_group_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/' ) );
     929        }
     930
     931        return apply_filters( 'bp_get_group_permalink', trailingslashit( bp_get_groups_directory_permalink() . $group->slug . '/' ) );
    931932    }
    932933
     
    28912892            'link_title' => __( 'Create a Group', 'buddypress' ),
    28922893            'link_class' => 'group-create no-ajax',
    2893             'link_href'  => trailingslashit( bp_get_root_domain() ) . trailingslashit( bp_get_groups_root_slug() ) . trailingslashit( 'create' ),
     2894            'link_href'  => trailingslashit( bp_get_groups_directory_permalink() . 'create' ),
    28942895            'wrapper'    => false,
    28952896            'block_self' => false,
     
    36373638        $is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?>
    36383639
    3639         <li<?php if ( bp_get_groups_current_create_step() == $slug ) : ?> class="current"<?php endif; ?>><?php if ( $is_enabled ) : ?><a href="<?php echo bp_get_root_domain() . '/' . bp_get_groups_root_slug() ?>/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
     3640        <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
    36403641        $counter++;
    36413642    }
     
    36633664        }
    36643665
    3665         return apply_filters( 'bp_get_group_creation_form_action', trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_action_variable( 1 ) ) );
     3666        return apply_filters( 'bp_get_group_creation_form_action', trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_action_variable( 1 ) ) );
    36663667    }
    36673668
     
    38283829        }
    38293830
    3830         return apply_filters( 'bp_get_group_creation_previous_link', trailingslashit( bp_get_root_domain() ) . bp_get_groups_root_slug() . '/create/step/' . array_pop( $previous_steps ) );
     3831        return apply_filters( 'bp_get_group_creation_previous_link', trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . array_pop( $previous_steps ) ) );
    38313832    }
    38323833
     
    46484649
    46494650        if ( bp_is_current_action( 'create' ) ) {
    4650             $uninvite_url = bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/group-invites/?user_id=' . $user_id;
     4651            $uninvite_url = bp_get_groups_directory_permalink() . 'create/step/group-invites/?user_id=' . $user_id;
    46514652        } else {
    46524653            $uninvite_url = bp_get_group_permalink( groups_get_current_group() ) . 'send-invites/remove/' . $user_id;
  • TabularUnified trunk/src/bp-groups/bp-groups-widgets.php

    r9453 r9466  
    7272        echo $before_widget;
    7373
    74         $title = !empty( $instance['link_title'] ) ? '<a href="' . trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) . '">' . $title . '</a>' : $title;
     74        $title = !empty( $instance['link_title'] ) ? '<a href="' . bp_get_groups_directory_permalink() . '">' . $title . '</a>' : $title;
    7575
    7676        echo $before_title . $title . $after_title;
  • TabularUnified trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r9399 r9466  
    11521152        $user = new BP_Core_User( $friend_id );
    11531153
    1154         $uninvite_url = bp_is_current_action( 'create' ) ? bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/group-invites/?user_id=' . $friend_id : bp_get_group_permalink( $group ) . 'send-invites/remove/' . $friend_id;
     1154        $uninvite_url = bp_is_current_action( 'create' )
     1155            ? bp_get_groups_directory_permalink() . 'create/step/group-invites/?user_id=' . $friend_id
     1156            : bp_get_group_permalink( $group )    . 'send-invites/remove/' . $friend_id;
    11551157
    11561158        echo '<li id="uid-' . esc_attr( $user->id ) . '">';
  • TabularUnified trunk/src/bp-templates/bp-legacy/buddypress/forums/index.php

    r7965 r9466  
    125125                <div id="message" class="info">
    126126
    127                     <p><?php printf( __( "You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not <a href='%s'>create a new group</a>? Once you have joined or created the group you can post your topic in that group's forum.", 'buddypress' ), site_url( bp_get_groups_root_slug() . '/create/' ) ); ?></p>
     127                    <p><?php printf( __( "You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not <a href='%s'>create a new group</a>? Once you have joined or created the group you can post your topic in that group's forum.", 'buddypress' ), trailingslashit( bp_get_groups_directory_permalink() . 'create' ) ); ?></p>
    128128
    129129                </div>
Note: See TracChangeset for help on using the changeset viewer.