Ticket #2579: 2579.01.patch
File 2579.01.patch, 9.8 KB (added by , 13 years ago) |
---|
-
buddypress/bp-activity/bp-activity-actions.php
24 24 return false; 25 25 26 26 // Get the activity details 27 $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->action_variables[0] ) );27 $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->action_variables[0], 'show_hidden' => true ) ); 28 28 29 29 // Redirect to root if activity does not exist 30 30 if ( !$activity = $activity['activities'][0] ) 31 31 bp_core_redirect( bp_get_root_domain() ); 32 32 33 // D o not redirect at default34 $redirect = false;33 // Default redirect is to /members/[username]/id/ 34 $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id . '/'; 35 35 36 36 // Redirect based on the type of activity 37 37 if ( bp_is_active( 'groups' ) && $activity->component == $bp->groups->id ) { 38 38 39 // Activity is a user update 40 if ( !empty( $activity->user_id ) ) { 41 $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id . '/'; 42 43 // Activity is something else 44 } else { 45 46 // Set redirect to group activity stream 47 if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) { 48 $redirect = bp_get_group_permalink( $group ) . $bp->activity->slug . '/' . $activity->id . '/'; 49 } 39 // Set redirect to group activity stream 40 if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) { 41 $redirect = bp_get_group_permalink( $group ) . $bp->activity->slug . '/' . $activity->id . '/'; 50 42 } 51 52 // Set redirect to users' activity stream53 } else {54 $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->slug . '/' . $activity->id;55 43 } 56 44 57 // Allow redirect to be filtered 45 // Allow redirect to be filtered, return false to redirect to root 58 46 if ( !$redirect = apply_filters( 'bp_activity_permalink_redirect_url', $redirect, &$activity ) ) 59 47 bp_core_redirect( bp_get_root_domain() ); 60 48 -
buddypress/bp-activity/bp-activity-screens.php
74 74 // No displayed user or not viewing activity component 75 75 if ( !bp_is_activity_component() ) 76 76 return false; 77 78 if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action ) ) 79 return false; 80 77 78 if ( empty( $bp->current_action ) || !is_numeric( $bp->current_action ) ) 79 return false; 80 81 81 // Get the activity details 82 $activity = bp_activity_get_specific( array( 'activity_ids' => bp_current_action() ) );82 $activity = bp_activity_get_specific( array( 'activity_ids' => bp_current_action(), 'show_hidden' => true ) ); 83 83 84 84 if ( !$activity = $activity['activities'][0] ) 85 85 bp_core_redirect( bp_get_root_domain() ); 86 86 87 // Default access is true 88 $has_access = true; 89 90 // If activity is from a group, do an extra cap check 91 if ( isset( $bp->groups->id ) && $activity->component == $bp->groups->id ) { 92 93 // Activity is from a group, but groups is currently disabled 94 if ( !bp_is_active( 'groups') ) 95 bp_core_redirect( bp_get_root_domain() ); 96 97 // Check to see if the group is not public, if so, check the 98 // user has access to see this activity 99 if ( $group = groups_get_group( array( 'group_id' => $activity->item_id ) ) ) { 100 101 // Group is not public 102 if ( 'public' != $group->status ) { 103 104 // User is not a member of group 105 if ( !groups_is_user_member( $bp->loggedin_user->id, $group->id ) ) { 106 $has_access = false; 107 } 108 } 109 } 110 } 111 112 // Allow access to be filtered 113 $has_access = apply_filters( 'bp_activity_permalink_access', $has_access, &$activity ); 87 // Default access is true; allow access to be filtered 88 $has_access = apply_filters( 'bp_activity_permalink_access', true, &$activity ); 114 89 115 90 // Allow additional code execution 116 91 do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access ); -
buddypress/bp-core/bp-core-template.php
34 34 $the_index = $bp->current_item; 35 35 } 36 36 } 37 37 38 38 // Loop through each navigation item 39 39 foreach ( (array)$bp->bp_options_nav[$the_index] as $subnav_item ) { 40 40 if ( !$subnav_item['user_has_access'] ) … … 242 242 // Displayed user 243 243 } elseif ( !empty( $bp->displayed_user->fullname ) && !is_404() ) { 244 244 // translators: "displayed user's name | canonicalised component name" 245 $title = strip_tags( sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->displayed_user->fullname, ucwords( bp_current_component() ) ) ); 245 $title = strip_tags( sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->displayed_user->fullname, ucwords( bp_current_component() ) ) ); 246 246 247 247 // A single group 248 248 } elseif ( bp_is_active( 'groups' ) && !empty( $bp->groups->current_group ) && !empty( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ) { … … 964 964 if ( bp_is_current_component( 'activity' ) && is_numeric( $bp->current_action ) ) 965 965 return true; 966 966 967 return false; 967 if ( bp_group_is_activity_permalink() ) 968 return true; 969 970 return apply_filters( 'bp_is_single_activity', false ); 968 971 } 969 972 970 973 /** User **********************************************************************/ -
buddypress/bp-groups/bp-groups-screens.php
437 437 438 438 $bp->is_single_item = true; 439 439 440 bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) ); 440 // Get the activity details 441 $activity = bp_activity_get_specific( array( 'activity_ids' => $bp->action_variables[0], 'show_hidden' => true ) ); 442 443 // If no activities, redirect to root 444 if ( !$activity = $activity['activities'][0] ) 445 bp_core_redirect( bp_get_root_domain() ); 446 447 // If activity isn't from the current group, redirect to root 448 if ( $activity->item_id != $bp->groups->current_group->id ) 449 bp_core_redirect( bp_get_root_domain() ); 450 451 // Grab group access status; allow access to be filtered 452 $has_access = apply_filters( 'bp_group_activity_permalink_access', $bp->groups->current_group->user_has_access, &$activity ); 453 454 // Allow additional code execution 455 do_action( 'bp_group_screen_single_activity_permalink', $activity, $has_access ); 456 457 // Access is specifically disallowed 458 if ( false === $has_access ) { 459 460 // User feedback 461 bp_core_add_message( __( 'You do not have access to this activity.', 'buddypress' ), 'error' ); 462 463 // Redirect based on logged in status 464 is_user_logged_in() ? 465 bp_core_redirect( $bp->loggedin_user->domain ) : 466 bp_core_redirect( site_url( 'wp-login.php?redirect_to=' . bp_get_group_permalink( $bp->groups->current_group ) . $bp->activity->slug . '/' . $activity->id . '/' ) ); 467 } 468 469 bp_core_load_template( apply_filters( 'groups_template_group_activity_permalink', 'groups/single/activity/permalink' ) ); 441 470 } 442 471 add_action( 'bp_screens', 'groups_screen_group_activity_permalink' ); 443 472 -
buddypress/bp-groups/bp-groups-template.php
625 625 return true; 626 626 } 627 627 628 function bp_group_activity_id() { 629 echo bp_group_get_activity_id(); 630 } 631 function bp_group_get_activity_id() { 632 global $bp; 633 634 if ( bp_group_is_activity_permalink() ) { 635 if ( $id = $bp->action_variables[0] ) 636 return $id; 637 } 638 639 return false; 640 } 641 628 642 function bp_groups_pagination_links() { 629 643 echo bp_get_groups_pagination_links(); 630 644 } … … 1452 1466 var $total_group_count; 1453 1467 1454 1468 function bp_groups_group_members_template( $group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned, $exclude ) { 1455 $this->__construct( $group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned, $exclude ); 1469 $this->__construct( $group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned, $exclude ); 1456 1470 } 1457 1471 1458 1472 function __construct( $group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned, $exclude ) { 1459 1473 global $bp; 1460 1474 … … 2174 2188 function bp_groups_membership_requests_template( $group_id, $per_page, $max ) { 2175 2189 $this->__construct( $group_id, $per_page, $max ); 2176 2190 } 2177 2178 2191 2192 2179 2193 function __construct( $group_id, $per_page, $max ) { 2180 2194 2181 2195 global $bp; 2182 2196 2183 2197 $this->pag_page = isset( $_REQUEST['mrpage'] ) ? intval( $_REQUEST['mrpage'] ) : 1; … … 2348 2362 var $total_invite_count; 2349 2363 2350 2364 function bp_groups_invite_template( $user_id, $group_id ) { 2351 $this->__construct( $user_id, $group_id ); 2365 $this->__construct( $user_id, $group_id ); 2352 2366 } 2353 2367 2354 2368 function __construct( $user_id, $group_id ) { 2355 2369 2356 2370 global $bp; 2357 2371 2358 2372 $this->invites = groups_get_invites_for_group( $user_id, $group_id ); 2359 2373 $this->invite_count = count( $this->invites ); 2360 2374 -
buddypress/bp-themes/bp-default/groups/single/activity/permalink.php
1 <?php get_header( 'buddypress' ) ?> 2 3 <div class="activity no-ajax" role="main"> 4 <?php if ( bp_has_activities( 'display_comments=threaded&show_hidden=true&include=' . bp_group_get_activity_id() ) ) : ?> 5 6 <ul id="activity-stream" class="activity-list item-list"> 7 <?php while ( bp_activities() ) : bp_the_activity(); ?> 8 9 <?php locate_template( array( 'activity/entry.php' ), true ) ?> 10 11 <?php endwhile; ?> 12 </ul> 13 14 <?php endif; ?> 15 </div> 16 17 <?php get_footer( 'buddypress' ) ?> 18 No newline at end of file