Skip to:
Content

BuddyPress.org

Changeset 4646


Ignore:
Timestamp:
07/12/2011 01:52:18 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Audit the usage of $bp->activity->slug. See #3325.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-actions.php

    r4548 r4646  
    1717
    1818    // Not viewing activity
    19     if ( ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'p' ) )
     19    if ( ( bp_is_activity_component() ) || !bp_is_current_action( 'p' ) )
    2020        return false;
    2121
     
    4444        // Activity is a user update
    4545        if ( !empty( $activity->user_id ) ) {
    46             $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id . '/';
     46            $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
    4747
    4848        // Activity is something else
     
    5151            // Set redirect to group activity stream
    5252            if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) {
    53                 $redirect = bp_get_group_permalink( $group ) . $bp->activity->slug . '/' . $activity->id . '/';
     53                $redirect = bp_get_group_permalink( $group ) . bp_get_activity_slug() . '/' . $activity->id . '/';
    5454            }
    5555        }
     
    5757    // Set redirect to users' activity stream
    5858    } else {
    59         $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id;
     59        $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id;
    6060    }
    6161
     
    126126
    127127    // Do not proceed if user is not logged in, not viewing activity, or not posting
    128     if ( !is_user_logged_in() || ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'post' ) )
     128    if ( !is_user_logged_in() || bp_is_activity_component() || !bp_is_current_action( 'post' ) )
    129129        return false;
    130130
     
    172172    global $bp;
    173173
    174     if ( !is_user_logged_in() || ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'reply' ) )
     174    if ( !is_user_logged_in() || ( bp_is_activity_component() ) || !bp_is_current_action( 'reply' ) )
    175175        return false;
    176176
     
    204204    global $bp;
    205205
    206     if ( !is_user_logged_in() || ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'favorite' ) )
     206    if ( !is_user_logged_in() || ( bp_is_activity_component() ) || !bp_is_current_action( 'favorite' ) )
    207207        return false;
    208208
     
    222222    global $bp;
    223223
    224     if ( !is_user_logged_in() || ( $bp->activity->slug != bp_current_component() ) || !bp_is_current_action( 'unfavorite' ) )
     224    if ( !is_user_logged_in() || ( bp_is_activity_component() ) || !bp_is_current_action( 'unfavorite' ) )
    225225        return false;
    226226
  • trunk/bp-activity/bp-activity-functions.php

    r4628 r4646  
    126126            $activity_id      = $item_id;
    127127            $poster_user_id   = $secondary_item_id;
    128             $at_mention_link  = $bp->loggedin_user->domain . $bp->activity->slug . '/mentions/';
     128            $at_mention_link  = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/';
    129129            $at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), $bp->loggedin_user->userdata->user_nicename );
    130130
  • trunk/bp-activity/bp-activity-screens.php

    r4605 r4646  
    147147        is_user_logged_in() ?
    148148            bp_core_redirect( $bp->loggedin_user->domain ) :
    149             bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . esc_url( bp_get_root_domain() . '/' . $bp->activity->slug . '/p/' . $bp->current_action ) ) );
     149            bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . esc_url( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $bp->current_action ) ) );
    150150    }
    151151
  • trunk/bp-activity/bp-activity-template.php

    r4611 r4646  
    249249
    250250    // Support for permalinks on single item pages: /groups/my-group/activity/124/
    251     if ( $bp->current_action == $bp->activity->slug )
     251    if ( bp_is_current_action( bp_get_activity_slug() ) )
    252252        $include = $bp->action_variables[0];
    253253
     
    10321032        global $bp;
    10331033       
    1034         $link = wp_nonce_url( bp_get_root_domain() . '/' . $bp->activity->slug . '/delete/?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' );
     1034        $link = wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/delete/?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' );
    10351035       
    10361036        return apply_filters( 'bp_activity_comment_delete_link', $link );
     
    13641364            return false;
    13651365
    1366         return apply_filters( 'bp_get_send_public_message_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->activity->slug . '/?r=' . bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) );
     1366        return apply_filters( 'bp_get_send_public_message_link', wp_nonce_url( bp_loggedin_user_domain() . bp_get_activity_slug() . '/?r=' . bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) );
    13671367    }
    13681368
     
    14401440        global $bp;
    14411441
    1442         if ( $bp->current_component == $bp->profile->slug || 'just-me' == $bp->current_action )
    1443             $link = $bp->displayed_user->domain . $bp->activity->slug . '/feed/';
    1444         elseif ( bp_is_active( 'friends' ) && $bp->friends->slug == $bp->current_action )
    1445             $link = $bp->displayed_user->domain . $bp->activity->slug . '/' . $bp->friends->slug . '/feed/';
    1446         elseif ( bp_is_active( 'groups' ) && $bp->groups->slug == $bp->current_action )
    1447             $link = $bp->displayed_user->domain . $bp->activity->slug . '/' . $bp->groups->slug . '/feed/';
     1442        if ( bp_is_profile_component() || bp_is_current_action( 'just-me' ) )
     1443            $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/feed/';
     1444        elseif ( bp_is_active( 'friends' ) && bp_is_current_action( bp_get_friends_slug() ) )
     1445            $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed/';
     1446        elseif ( bp_is_active( 'groups'  ) && bp_is_current_action( bp_get_groups_slug()  ) )
     1447            $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/';
    14481448        elseif ( 'favorites' == $bp->current_action )
    1449             $link = $bp->displayed_user->domain . $bp->activity->slug . '/favorites/feed/';
     1449            $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
    14501450        elseif ( 'mentions' == $bp->current_action )
    1451             $link = $bp->displayed_user->domain . $bp->activity->slug . '/mentions/feed/';
     1451            $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
    14521452        else
    14531453            $link = '';
  • trunk/bp-activity/feeds/bp-activity-friends-feed.php

    r4373 r4646  
    2121    <title><?php bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'Friends Activity', 'buddypress' ) ?></title>
    2222    <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    23     <link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/my-friends/feed' ?></link>
     23    <link><?php echo bp_displayed_user_domain() . bp_get_activity_slug() . '/my-friends/feed' ?></link>
    2424    <description><?php printf( __( '%s - Friends Activity Feed', 'buddypress' ), $bp->displayed_user->fullname ) ?></description>
    2525    <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
  • trunk/bp-activity/feeds/bp-activity-group-feed.php

    r4373 r4646  
    2121    <title><?php bp_site_name() ?> | <?php echo $bp->groups->current_group->name ?> | <?php _e( 'Group Activity', 'buddypress' ) ?></title>
    2222    <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    23     <link><?php echo bp_get_group_permalink( $bp->groups->current_group ) . $bp->activity->slug . '/feed' ?></link>
     23    <link><?php echo bp_get_group_permalink( $bp->groups->current_group ) . bp_get_activity_slug() . '/feed' ?></link>
    2424    <description><?php printf( __( '%s - Group Activity Feed', 'buddypress' ), $bp->groups->current_group->name  ) ?></description>
    2525    <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
  • trunk/bp-activity/feeds/bp-activity-personal-feed.php

    r4373 r4646  
    2121    <title><?php bp_site_name() ?> | <?php echo $bp->displayed_user->fullname; ?> | <?php _e( 'Activity', 'buddypress' ) ?></title>
    2222    <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    23     <link><?php echo $bp->displayed_user->domain . $bp->activity->slug . '/feed' ?></link>
     23    <link><?php echo bp_displayed_user_domain() . bp_get_activity_slug() . '/feed' ?></link>
    2424    <description><?php printf( __( '%s - Activity Feed', 'buddypress' ), $bp->displayed_user->fullname ) ?></description>
    2525    <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
  • trunk/bp-activity/feeds/bp-activity-sitewide-feed.php

    r4373 r4646  
    2222    <title><?php bp_site_name() ?> | <?php _e( 'Site Wide Activity', 'buddypress' ) ?></title>
    2323    <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    24     <link><?php echo site_url() . '/' . $bp->activity->slug . '/feed' ?></link>
     24    <link><?php echo bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed' ?></link>
    2525    <description><?php _e( 'Site Wide Activity Feed', 'buddypress' ) ?></description>
    2626    <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
  • trunk/bp-groups/bp-groups-screens.php

    r4638 r4646  
    442442    global $bp;
    443443
    444     if ( !bp_is_groups_component() || !bp_is_active( 'activity' ) || ( bp_is_active( 'activity' ) && !bp_is_current_action( $bp->activity->slug ) ) || empty( $bp->action_variables[0] ) )
     444    if ( !bp_is_groups_component() || !bp_is_active( 'activity' ) || ( bp_is_active( 'activity' ) && !bp_is_current_action( bp_get_activity_slug() ) ) || empty( $bp->action_variables[0] ) )
    445445        return false;
    446446
  • trunk/bp-groups/bp-groups-template.php

    r4638 r4646  
    678678
    679679function bp_group_is_activity_permalink() {
    680     global $bp;
    681 
    682     if ( !bp_is_single_item() || !bp_is_current_component( 'groups' ) || !bp_is_current_action( $bp->activity->slug ) )
     680
     681    if ( !bp_is_single_item() || !bp_is_current_component( 'groups' ) || !bp_is_current_action( bp_get_activity_slug() ) )
    683682        return false;
    684683
     
    715714}
    716715
    717 function bp_group_total_members() {
    718     echo bp_get_group_total_members();
     716function bp_group_total_members( $group = false ) {
     717    echo bp_get_group_total_members( $group );
    719718}
    720719    function bp_get_group_total_members( $group = false ) {
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r4628 r4646  
    224224                    <?php if ( bp_activity_user_can_delete() ) : ?>
    225225                        <div class="acomment-options">
    226                             <a href="<?php echo wp_nonce_url( bp_get_root_domain() . '/' . $bp->activity->slug . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm bp-secondary-action" rel="nofollow"><?php _e( 'Delete', 'buddypress' ); ?></a>
     226                            <a href="<?php echo wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm bp-secondary-action" rel="nofollow"><?php _e( 'Delete', 'buddypress' ); ?></a>
    227227                        </div>
    228228                    <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.