Changeset 6285 for trunk/bp-activity/bp-activity-screens.php
- Timestamp:
- 09/03/2012 12:33:13 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/bp-activity/bp-activity-screens.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-screens.php
r6093 r6285 304 304 add_action( 'bp_notification_settings', 'bp_activity_screen_notification_settings', 1 ); 305 305 306 ?> 306 /** Theme Compatability *******************************************************/ 307 308 /** 309 * The main theme compat class for BuddyPress Activity 310 * 311 * This class sets up the necessary theme compatability actions to safely output 312 * group template parts to the_title and the_content areas of a theme. 313 * 314 * @since BuddyPress (1.7) 315 */ 316 class BP_Activity_Theme_Compat { 317 318 /** 319 * Setup the activity component theme compatibility 320 * 321 * @since BuddyPress (1.7) 322 */ 323 public function __construct() { 324 add_action( 'bp_setup_theme_compat', array( $this, 'is_activity' ) ); 325 } 326 327 /** 328 * Are we looking at something that needs activity theme compatability? 329 * 330 * @since BuddyPress (1.7) 331 */ 332 public function is_activity() { 333 334 // Bail if not looking at a group 335 if ( ! bp_is_activity_component() ) 336 return; 337 338 // Activity Directory 339 if ( ! bp_displayed_user_id() && ! bp_current_action() ) { 340 bp_update_is_directory( true, 'activity' ); 341 342 do_action( 'bp_activity_screen_index' ); 343 344 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) ); 345 add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) ); 346 } 347 } 348 349 /** Directory *************************************************************/ 350 351 /** 352 * Update the global $post with directory data 353 * 354 * @since BuddyPress (1.7) 355 */ 356 public function directory_dummy_post() { 357 bp_theme_compat_reset_post( array( 358 'ID' => 0, 359 'post_title' => __( 'Sitewide Activity', 'buddypress' ), 360 'post_author' => 0, 361 'post_date' => 0, 362 'post_content' => '', 363 'post_type' => 'bp_activity', 364 'post_status' => 'publish', 365 'is_archive' => true, 366 'comment_status' => 'closed' 367 ) ); 368 } 369 370 /** 371 * Filter the_content with the groups index template part 372 * 373 * @since BuddyPress (1.7) 374 */ 375 public function directory_content() { 376 bp_buffer_template_part( 'activity/index' ); 377 } 378 } 379 new BP_Activity_Theme_Compat();
Note: See TracChangeset
for help on using the changeset viewer.