Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/11/2012 03:54:27 PM (12 years ago)
Author:
boonebgorges
Message:

Improvements to link construction and filters in the Groups component:

  • Fixes arguments being passed to bp_groups_get_total_groups_sql filter
  • Passes additional arguments to various group link filters
  • Sweeps through link concatenation in the groups component, to ensure that bp_get_group_permalink is used wherever possible (allowing for centralized filters in plugins)
  • Corrects some inline documentation
  • Fixes the permissions logic in bp_groups_adminbar_admin_menu(), so that super admins and group admins are able to see the group-specific dropdown when using the BuddyBar
  • Fixes #4071. Props travel-junkie
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-template.php

    r5893 r5903  
    446446            $group =& $groups_template->group;
    447447
    448         return apply_filters( 'bp_get_group_permalink', bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/' );
     448        return apply_filters( 'bp_get_group_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/' ) );
    449449    }
    450450
     
    458458            $group =& $groups_template->group;
    459459
    460         return apply_filters( 'bp_get_group_admin_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/admin' ) );
     460        return apply_filters( 'bp_get_group_admin_permalink', trailingslashit( bp_get_group_permalink( $group ) . '/admin' ) );
    461461    }
    462462
     
    12671267    if ( bp_is_item_admin() || bp_is_item_mod() ) : ?>
    12681268
    1269         <li<?php if ( 'edit-details' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/admin/edit-details' ) ?>"><?php _e( 'Details', 'buddypress' ); ?></a></li>
     1269        <li<?php if ( 'edit-details' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/edit-details' ) ?>"><?php _e( 'Details', 'buddypress' ); ?></a></li>
    12701270
    12711271    <?php endif; ?>
     
    12741274            return false; ?>
    12751275
    1276     <li<?php if ( 'group-settings' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/admin/group-settings' ) ?>"><?php _e( 'Settings', 'buddypress' ); ?></a></li>
     1276    <li<?php if ( 'group-settings' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/group-settings' ) ?>"><?php _e( 'Settings', 'buddypress' ); ?></a></li>
    12771277
    12781278    <?php if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) ) : ?>
    12791279
    1280         <li<?php if ( 'group-avatar'   == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/admin/group-avatar' ) ?>"><?php _e( 'Avatar', 'buddypress' ); ?></a></li>
     1280        <li<?php if ( 'group-avatar'   == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/group-avatar' ) ?>"><?php _e( 'Avatar', 'buddypress' ); ?></a></li>
    12811281
    12821282    <?php endif; ?>
    12831283
    1284     <li<?php if ( 'manage-members' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/admin/manage-members' ) ?>"><?php _e( 'Members', 'buddypress' ); ?></a></li>
     1284    <li<?php if ( 'manage-members' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members' ) ?>"><?php _e( 'Members', 'buddypress' ); ?></a></li>
    12851285
    12861286    <?php if ( $groups_template->group->status == 'private' ) : ?>
    12871287
    1288         <li<?php if ( 'membership-requests' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/admin/membership-requests' ) ?>"><?php _e( 'Requests', 'buddypress' ); ?></a></li>
     1288        <li<?php if ( 'membership-requests' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/membership-requests' ) ?>"><?php _e( 'Requests', 'buddypress' ); ?></a></li>
    12891289
    12901290    <?php endif; ?>
     
    12921292    <?php do_action( 'groups_admin_tabs', $current_tab, $group->slug ) ?>
    12931293
    1294     <li<?php if ( 'delete-group' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/admin/delete-group' ) ?>"><?php _e( 'Delete', 'buddypress' ); ?></a></li>
     1294    <li<?php if ( 'delete-group' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/delete-group' ) ?>"><?php _e( 'Delete', 'buddypress' ); ?></a></li>
    12951295
    12961296<?php
     
    16641664}
    16651665    function bp_get_total_group_count_for_user( $user_id = 0 ) {
    1666         return apply_filters( 'bp_get_total_group_count_for_user', groups_total_groups_for_user( $user_id ) );
     1666        return apply_filters( 'bp_get_total_group_count_for_user', groups_total_groups_for_user( $user_id ), $user_id );
    16671667    }
    16681668
     
    28292829        global $bp;
    28302830
    2831         // Must be displayed user
     2831        // Must be a group
    28322832        if ( empty( $bp->groups->current_group->id ) )
    28332833            return;
    28342834
    2835         // Append $action to $url if there is no $type
     2835        // Append $action to $url if provided
    28362836        if ( !empty( $action ) )
    2837             $url = bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $bp->groups->current_group->slug . '/' . $action;
     2837            $url = bp_get_group_permalink( groups_get_current_group() ) . $action;
    28382838        else
    2839             $url = bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $bp->groups->current_group->slug;
     2839            $url = bp_get_group_permalink( groups_get_current_group() );
    28402840
    28412841        // Add a slash at the end of our user url
Note: See TracChangeset for help on using the changeset viewer.