Ticket #2086: 2086.01.patch
File 2086.01.patch, 13.3 KB (added by , 13 years ago) |
---|
-
bp-activity/bp-activity-actions.php
diff --git bp-activity/bp-activity-actions.php bp-activity/bp-activity-actions.php index 509d2bd..f73e579 100644
add_action( 'bp_actions', 'bp_activity_action_mentions_feed' ); 577 577 function bp_activity_action_favorites_feed() { 578 578 global $bp, $wp_query; 579 579 580 if ( !bp_is_user_activity() || !bp_is_current_action( 'favorites') || !bp_is_action_variable( 'feed', 0 ) )580 if ( !bp_is_user_activity() || !bp_is_current_action( bp_get_activity_favorites_slug() ) || !bp_is_action_variable( 'feed', 0 ) ) 581 581 return false; 582 582 583 583 $wp_query->is_404 = false; -
bp-activity/bp-activity-loader.php
diff --git bp-activity/bp-activity-loader.php bp-activity/bp-activity-loader.php index 700fb72..6d53d67 100644
class BP_Activity_Component extends BP_Component { 76 76 // Define a slug, if necessary 77 77 if ( !defined( 'BP_ACTIVITY_SLUG' ) ) 78 78 define( 'BP_ACTIVITY_SLUG', $this->id ); 79 80 $slug_defaults = array( 81 'root_slug' => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG, 82 'slug' => BP_ACTIVITY_SLUG, 83 'just-me' => 'just-me', 84 'favorites' => 'favorites', 85 'mentions' => 'mentions' 86 ); 87 88 $slugs = bp_parse_component_slugs( 'activity', $slug_defaults ); 79 89 80 90 // Global tables for activity component 81 91 $global_tables = array( … … class BP_Activity_Component extends BP_Component { 87 97 // Note that global_tables is included in this array. 88 98 $globals = array( 89 99 'path' => BP_PLUGIN_DIR, 90 'slug' => BP_ACTIVITY_SLUG, 91 'root_slug' => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG, 100 'slugs' => $slugs, 101 'slug' => $slugs['slug'], 102 'root_slug' => $slugs['root_slug'], 92 103 'has_directory' => true, 93 104 'search_string' => __( 'Search Activity...', 'buddypress' ), 94 105 'global_tables' => $global_tables, … … class BP_Activity_Component extends BP_Component { 118 129 'slug' => $this->slug, 119 130 'position' => 10, 120 131 'screen_function' => 'bp_activity_screen_my_activity', 121 'default_subnav_slug' => 'just-me',132 'default_subnav_slug' => $this->slugs['just-me'], 122 133 'item_css_id' => $this->id 123 134 ); 124 135 … … class BP_Activity_Component extends BP_Component { 140 151 // Add the subnav items to the activity nav item if we are using a theme that supports this 141 152 $sub_nav[] = array( 142 153 'name' => __( 'Personal', 'buddypress' ), 143 'slug' => 'just-me',154 'slug' => $this->slugs['just-me'], 144 155 'parent_url' => $activity_link, 145 156 'parent_slug' => $this->slug, 146 157 'screen_function' => 'bp_activity_screen_my_activity', … … class BP_Activity_Component extends BP_Component { 150 161 // @ mentions 151 162 $sub_nav[] = array( 152 163 'name' => __( 'Mentions', 'buddypress' ), 153 'slug' => 'mentions',164 'slug' => $this->slugs['mentions'], 154 165 'parent_url' => $activity_link, 155 166 'parent_slug' => $this->slug, 156 167 'screen_function' => 'bp_activity_screen_mentions', … … class BP_Activity_Component extends BP_Component { 161 172 // Favorite activity items 162 173 $sub_nav[] = array( 163 174 'name' => __( 'Favorites', 'buddypress' ), 164 'slug' => 'favorites',175 'slug' => $this->slugs['favorites'], 165 176 'parent_url' => $activity_link, 166 177 'parent_slug' => $this->slug, 167 178 'screen_function' => 'bp_activity_screen_favorites', … … class BP_Activity_Component extends BP_Component { 245 256 'parent' => 'my-account-' . $this->id, 246 257 'id' => 'my-account-' . $this->id . '-mentions', 247 258 'title' => $title, 248 'href' => trailingslashit( $activity_link . 'mentions')259 'href' => trailingslashit( $activity_link . bp_get_activity_mentions_slug() ) 249 260 ); 250 261 251 262 // Personal … … class BP_Activity_Component extends BP_Component { 261 272 'parent' => 'my-account-' . $this->id, 262 273 'id' => 'my-account-' . $this->id . '-favorites', 263 274 'title' => __( 'Favorites', 'buddypress' ), 264 'href' => trailingslashit( $activity_link . 'favorites')275 'href' => trailingslashit( $activity_link . bp_get_activity_favorites_slug() ) 265 276 ); 266 277 267 278 // Friends? -
bp-activity/bp-activity-template.php
diff --git bp-activity/bp-activity-template.php bp-activity/bp-activity-template.php index 049d347..2d1b827 100644
function bp_activity_slug() { 25 25 * 26 26 * @since 1.5.0 27 27 * 28 * @global object $bp BuddyPress global settings29 28 * @uses apply_filters() To call the 'bp_get_activity_slug' hook 30 29 */ 31 30 function bp_get_activity_slug() { 32 global $bp; 33 return apply_filters( 'bp_get_activity_slug', $bp->activity->slug ); 31 return apply_filters( 'bp_get_activity_slug', bp_get_slug( 'activity', 'slug' ) ); 34 32 } 35 33 36 34 /** … … function bp_activity_root_slug() { 48 46 * 49 47 * @since 1.5.0 50 48 * 51 * @global object $bp BuddyPress global settings52 49 * @uses apply_filters() To call the 'bp_get_activity_root_slug' hook 53 50 */ 54 51 function bp_get_activity_root_slug() { 55 global $bp; 56 return apply_filters( 'bp_get_activity_root_slug', $bp->activity->root_slug ); 52 return apply_filters( 'bp_get_activity_root_slug', bp_get_slug( 'activity', 'root_slug' ) ); 53 } 54 55 /** 56 * Output the activity component 'just-me' slug 57 * 58 * @since 1.6 59 * 60 * @uses bp_get_activity_justme_slug() 61 */ 62 function bp_activity_justme_slug() { 63 echo bp_get_activity_justme_slug(); 64 } 65 /** 66 * Return the activity component 'just-me' slug 67 * 68 * @since 1.6 69 * 70 * @uses apply_filters() To call the 'bp_get_activity_justme_slug' hook 71 */ 72 function bp_get_activity_justme_slug() { 73 return apply_filters( 'bp_get_activity_justme_slug', bp_get_slug( 'activity', 'just-me' ) ); 74 } 75 76 /** 77 * Output the activity component 'favorites' slug 78 * 79 * @since 1.6 80 * 81 * @uses bp_get_activity_favorites_slug() 82 */ 83 function bp_activity_favorites_slug() { 84 echo bp_get_activity_favorites_slug(); 85 } 86 /** 87 * Return the activity component 'favorites' slug 88 * 89 * @since 1.6 90 * 91 * @uses apply_filters() To call the 'bp_get_activity_favorites_slug' hook 92 */ 93 function bp_get_activity_favorites_slug() { 94 return apply_filters( 'bp_get_activity_favorites_slug', bp_get_slug( 'activity', 'favorites' ) ); 95 } 96 97 /** 98 * Output the activity component 'mentions' slug 99 * 100 * @since 1.6 101 * 102 * @uses bp_get_activity_mentions_slug() 103 */ 104 function bp_activity_mentions_slug() { 105 echo bp_get_activity_mentions_slug(); 106 } 107 /** 108 * Return the activity component 'mentions' slug 109 * 110 * @since 1.6 111 * 112 * @uses apply_filters() To call the 'bp_get_activity_mentions_slug' hook 113 */ 114 function bp_get_activity_mentions_slug() { 115 return apply_filters( 'bp_get_activity_mentions_slug', bp_get_slug( 'activity', 'mentions' ) ); 57 116 } 58 117 59 118 /** … … function bp_has_activities( $args = '' ) { 279 338 // The default scope should recognize custom slugs 280 339 if ( array_key_exists( $bp->current_action, (array)$bp->loaded_components ) ) { 281 340 $scope = $bp->loaded_components[$bp->current_action]; 282 } 283 else 341 } else if ( $slug_index = array_search( bp_current_action(), $bp->activity->slugs ) ) { 342 $scope = $slug_index; 343 } else { 284 344 $scope = bp_current_action(); 345 } 285 346 286 347 // Support for permalinks on single item pages: /groups/my-group/activity/124/ 287 348 if ( bp_is_current_action( bp_get_activity_slug() ) ) … … function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link 2486 2547 function bp_get_member_activity_feed_link() { 2487 2548 global $bp; 2488 2549 2489 if ( bp_is_profile_component() || bp_is_current_action( 'just-me') )2550 if ( bp_is_profile_component() || bp_is_current_action( bp_get_activity_justme_slug() ) ) 2490 2551 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/feed/'; 2491 2552 elseif ( bp_is_active( 'friends' ) && bp_is_current_action( bp_get_friends_slug() ) ) 2492 2553 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed/'; 2493 elseif ( bp_is_active( 'groups' 2554 elseif ( bp_is_active( 'groups' ) && bp_is_current_action( bp_get_groups_slug() ) ) 2494 2555 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/'; 2495 elseif ( 'favorites' == $bp->current_action)2496 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/ favorites/feed/';2497 elseif ( 'mentions' == $bp->current_action)2498 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/';2556 elseif ( bp_is_current_action( bp_get_activity_favorites_slug() ) ) 2557 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_activity_favorites_slug() . '/feed/'; 2558 elseif ( bp_is_current_action( bp_get_activity_mentions_slug() ) ) 2559 $link = bp_displayed_user_domain() . bp_get_activity_slug() . bp_get_activity_mentions_slug() . '/feed/'; 2499 2560 else 2500 2561 $link = ''; 2501 2562 -
bp-core/bp-core-component.php
diff --git bp-core/bp-core-component.php bp-core/bp-core-component.php index b857b24..2094fd6 100644
class BP_Component { 28 28 * @var Unique ID (normally for custom post type) 29 29 */ 30 30 var $id; 31 32 /** 33 * @var array Slugs for this component (used to construct permalinks) 34 */ 35 var $slugs; 31 36 32 37 /** 33 38 * @var string Unique slug (used in query string and permalinks) … … class BP_Component { 106 111 /** Slugs *************************************************************/ 107 112 108 113 $defaults = array( 114 'slugs' => array(), 109 115 'slug' => $this->id, 110 116 'root_slug' => '', 111 117 'has_directory' => false, … … class BP_Component { 115 121 ); 116 122 $r = wp_parse_args( $args, $defaults ); 117 123 124 // Component slugs 125 $this->slugs = apply_filters( 'bp_' . $this->id . '_slugs', $r['slugs'] ); 126 118 127 // Slug used for permalink URI chunk after root 119 128 $this->slug = apply_filters( 'bp_' . $this->id . '_slug', $r['slug'] ); 120 129 … … class BP_Component { 205 214 */ 206 215 function setup_actions() { 207 216 217 // Setup slugs 218 add_action( 'bp_setup_slugs', array ( $this, 'setup_slugs' ), 10 ); 219 208 220 // Setup globals 209 221 add_action( 'bp_setup_globals', array ( $this, 'setup_globals' ), 10 ); 210 222 -
bp-core/bp-core-functions.php
diff --git bp-core/bp-core-functions.php bp-core/bp-core-functions.php index 378715a..5fb37c1 100644
function bp_core_get_root_options() { 1113 1113 // BuddyPress core settings 1114 1114 'bp-deactivated-components' => serialize( array( ) ), 1115 1115 'bp-blogs-first-install' => '0', 1116 'bp-disable-blogforum-comments' => '0',1116 'bp-disable-blogforum-comments' => '0', 1117 1117 'bp-xprofile-base-group-name' => 'Base', 1118 1118 'bp-xprofile-fullname-field-name' => 'Name', 1119 1119 'bp-disable-profile-sync' => '0', … … function bp_core_get_root_options() { 1122 1122 'bp-disable-blogforum-comments' => '0', 1123 1123 'bb-config-location' => ABSPATH . 'bb-config.php', 1124 1124 'hide-loggedout-adminbar' => '0', 1125 'bp-slugs' => serialize( array() ), 1125 1126 1126 1127 // Useful WordPress settings 1127 1128 'registration' => '0', … … function bp_core_get_root_options() { 1184 1185 } else { 1185 1186 // Loop through our results and make them usable 1186 1187 foreach ( $root_blog_options_meta as $root_blog_option ) 1187 $root_blog_options[$root_blog_option->name] = $root_blog_option->value;1188 $root_blog_options[$root_blog_option->name] = maybe_unserialize( $root_blog_option->value ); 1188 1189 1189 1190 // Copy the options no the return val 1190 1191 $root_blog_options_meta = $root_blog_options; … … function bp_update_is_item_mod( $is_item_mod = false, $component = '' ) { 1581 1582 } 1582 1583 1583 1584 /** 1585 * Fetch a slug from the $bp global 1586 * 1587 * @since 1.6 1588 * @global obj $bp 1589 * 1590 * @param str $component_id The id of the component that the slug belongs to 1591 * @param str $slug_name The name of the slug you're fetching 1592 */ 1593 function bp_get_slug( $component_id = '', $slug_name = '' ) { 1594 global $bp; 1595 1596 $slug = ''; 1597 1598 if ( $component_id && $slug_name ) { 1599 if ( isset( $bp->{$component_id}->slugs[$slug_name] ) ) { 1600 $slug = $bp->{$component_id}->slugs[$slug_name]; 1601 } 1602 } 1603 1604 return apply_filters( 'bp_get_slug', $slug, $component_id, $slug_name ); 1605 } 1606 1607 /** 1608 * Parse a component's default slugs with the custom slugs saved to the database by the user 1609 * 1610 * Custom components should pass their slugs through this function in their setup_globals() method 1611 * so that they can be customized by site admins. 1612 * 1613 * @since 1.6 1614 * @global obj $bp 1615 * 1616 * @param str $component_id The id of the component the slugs belong to 1617 * @param array $slugs The default slugs passed along from the component loader 1618 */ 1619 function bp_parse_component_slugs( $component_id = '', $slugs = array() ) { 1620 global $bp; 1621 1622 $parsed_slugs = array(); 1623 $saved_slugs = (array)bp_get_option( 'bp-slugs' ); 1624 if ( !empty( $saved_slugs[$component_id] ) ) { 1625 $parsed_slugs = wp_parse_args( (array)$saved_slugs[$component_id], $slugs ); 1626 } 1627 1628 return apply_filters( 'bp_parse_component_slugs', $parsed_slugs, $component_id, $slugs ); 1629 } 1630 1631 /** 1584 1632 * Trigger a 404 1585 1633 * 1586 1634 * @global object $bp Global BuddyPress settings object