Skip to:
Content

BuddyPress.org

Ticket #3325: activity.patch

File activity.patch, 13.9 KB (added by johnjamesjacoby, 13 years ago)

Activity Slug Audit

  • bp-activity/bp-activity-actions.php

     
    1616        global $bp;
    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
    2222        // No activity to display
     
    4343
    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
    4949                } else {
    5050
    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                }
    5656
    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
    6262        // Allow redirect to be filtered
     
    125125        global $bp;
    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
    131131        // Check the nonce
     
    171171function bp_activity_action_post_comment() {
    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
    177177        // Check the nonce
     
    203203function bp_activity_action_mark_favorite() {
    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
    209209        // Check the nonce
     
    221221function bp_activity_action_remove_favorite() {
    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
    227227        // Check the nonce
  • bp-activity/bp-activity-functions.php

     
    125125                case 'new_at_mention':
    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
    131131                        if ( (int)$total_items > 1 ) {
  • bp-activity/bp-activity-screens.php

     
    146146                // Redirect based on logged in status
    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
    152152        bp_core_load_template( apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ) );
  • bp-activity/bp-activity-template.php

     
    248248                $scope = $bp->current_action;
    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
    254254        // Note: any params used for filtering can be a single value, or multiple values comma separated.
     
    10311031        function bp_get_activity_comment_delete_link() {
    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 );
    10371037        }
     
    13631363                if ( bp_is_my_profile() || !is_user_logged_in() )
    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
    13691369function bp_mentioned_user_display_name( $user_id_or_username ) {
     
    14391439        function bp_get_member_activity_feed_link() {
    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 = '';
    14541454
  • bp-activity/feeds/bp-activity-friends-feed.php

     
    2020<channel>
    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>
    2626        <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
  • bp-activity/feeds/bp-activity-group-feed.php

     
    2020<channel>
    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>
    2626        <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
  • bp-activity/feeds/bp-activity-personal-feed.php

     
    2020<channel>
    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>
    2626        <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
  • bp-activity/feeds/bp-activity-sitewide-feed.php

     
    2121<channel>
    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>
    2727        <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
  • bp-groups/bp-groups-screens.php

     
    441441function groups_screen_group_activity_permalink() {
    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] ) )
    445  No newline at end of file
     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] ) )
     445 No newline at end of file
    446446                return false;
    447447
  • bp-groups/bp-groups-template.php

     	$bp->is_single_item = true;
     
    677677}
    678678
    679679function bp_group_is_activity_permalink() {
    680         global $bp;
    681680
    682         if ( !bp_is_single_item() || !bp_is_current_component( 'groups' ) || !bp_is_current_action( $bp->activity->slug ) )
     681        if ( !bp_is_single_item() || !bp_is_current_component( 'groups' ) || !bp_is_current_action( bp_get_activity_slug() ) )
    683682                return false;
    684683
    685684        return true;
     
    714713        return apply_filters( 'bp_groups_auto_join', (bool)$bp->groups->auto_join );
    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 ) {
    721720                global $groups_template;
  • bp-themes/bp-default/_inc/ajax.php

     
    223223
    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>
    227  No newline at end of file
     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>
     227 No newline at end of file
    228228                                                </div>
    229229                                        <?php endif; ?>