Changeset 7207 for trunk/bp-activity/bp-activity-actions.php
- Timestamp:
- 06/12/2013 10:08:10 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-actions.php
r7193 r7207 422 422 */ 423 423 function bp_activity_action_sitewide_feed() { 424 global $bp, $wp_query; 425 426 if ( !bp_is_activity_component() || !bp_is_current_action( 'feed' ) || bp_is_user() || !empty( $bp->groups->current_group ) ) 427 return false; 428 429 $wp_query->is_404 = false; 430 status_header( 200 ); 431 432 include_once( 'feeds/bp-activity-sitewide-feed.php' ); 433 die; 424 global $bp; 425 426 if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) ) 427 return false; 428 429 // setup the feed 430 buddypress()->activity->feed = new BP_Activity_Feed( array( 431 'id' => 'sitewide', 432 433 /* translators: Sitewide activity RSS title - "[Site Name] | Site Wide Activity" */ 434 'title' => sprintf( __( '%s | Site Wide Activity', 'buddypress' ), bp_get_site_name() ), 435 436 'link' => bp_get_activity_directory_permalink(), 437 'description' => __( 'Activity feed for the entire site.', 'buddypress' ), 438 'activity_args' => 'display_comments=threaded' 439 ) ); 434 440 } 435 441 add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' ); … … 448 454 */ 449 455 function bp_activity_action_personal_feed() { 450 global $wp_query; 451 452 if ( !bp_is_user_activity() || !bp_is_current_action( 'feed' ) ) 453 return false; 454 455 $wp_query->is_404 = false; 456 status_header( 200 ); 457 458 include_once( 'feeds/bp-activity-personal-feed.php' ); 459 die; 456 if ( ! bp_is_user_activity() || ! bp_is_current_action( 'feed' ) ) { 457 return false; 458 } 459 460 // setup the feed 461 buddypress()->activity->feed = new BP_Activity_Feed( array( 462 'id' => 'personal', 463 464 /* translators: Personal activity RSS title - "[Site Name] | [User Display Name] | Activity" */ 465 'title' => sprintf( __( '%1$s | %2$s | Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ), 466 467 'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() ), 468 'description' => sprintf( __( 'Activity feed for %s.', 'buddypress' ), bp_get_displayed_user_fullname() ), 469 'activity_args' => 'user_id=' . bp_displayed_user_id() 470 ) ); 460 471 } 461 472 add_action( 'bp_actions', 'bp_activity_action_personal_feed' ); … … 477 488 */ 478 489 function bp_activity_action_friends_feed() { 479 global $wp_query; 480 481 if ( !bp_is_active( 'friends' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_friends_slug() ) || !bp_is_action_variable( 'feed', 0 ) ) 482 return false; 483 484 $wp_query->is_404 = false; 485 status_header( 200 ); 486 487 include_once( 'feeds/bp-activity-friends-feed.php' ); 488 die; 490 if ( ! bp_is_active( 'friends' ) || ! bp_is_user_activity() || ! bp_is_current_action( bp_get_friends_slug() ) || ! bp_is_action_variable( 'feed', 0 ) ) { 491 return false; 492 } 493 494 // setup the feed 495 buddypress()->activity->feed = new BP_Activity_Feed( array( 496 'id' => 'friends', 497 498 /* translators: Friends activity RSS title - "[Site Name] | [User Display Name] | Friends Activity" */ 499 'title' => sprintf( __( '%1$s | %2$s | Friends Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ), 500 501 'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() ), 502 'description' => sprintf( __( "Activity feed for %s' friends.", 'buddypress' ), bp_get_displayed_user_fullname() ), 503 'activity_args' => 'scope=friends' 504 ) ); 489 505 } 490 506 add_action( 'bp_actions', 'bp_activity_action_friends_feed' ); … … 506 522 */ 507 523 function bp_activity_action_my_groups_feed() { 524 if ( ! bp_is_active( 'groups' ) || ! bp_is_user_activity() || ! bp_is_current_action( bp_get_groups_slug() ) || ! bp_is_action_variable( 'feed', 0 ) ) { 525 return false; 526 } 527 528 // get displayed user's group IDs 529 $groups = groups_get_user_groups(); 530 $group_ids = implode( ',', $groups['groups'] ); 531 532 // setup the feed 533 buddypress()->activity->feed = new BP_Activity_Feed( array( 534 'id' => 'mygroups', 535 536 /* translators: Member groups activity RSS title - "[Site Name] | [User Display Name] | Groups Activity" */ 537 'title' => sprintf( __( '%1$s | %2$s | Group Activity', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ), 538 539 'link' => trailingslashit( bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() ), 540 'description' => sprintf( __( "Public group activity feed of which %s is a member of.", 'buddypress' ), bp_get_displayed_user_fullname() ), 541 'activity_args' => array( 542 'object' => buddypress()->groups->id, 543 'primary_id' => $group_ids, 544 'display_comments' => 'threaded' 545 ) 546 ) ); 547 } 548 add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' ); 549 550 /** 551 * Load a user's @mentions feed. 552 * 553 * @since BuddyPress (1.2) 554 * 555 * @global object $wp_query 556 * @uses bp_is_user_activity() 557 * @uses bp_is_current_action() 558 * @uses bp_is_action_variable() 559 * @uses status_header() 560 * 561 * @return bool False on failure 562 */ 563 function bp_activity_action_mentions_feed() { 508 564 global $wp_query; 509 565 510 if ( !bp_is_active( 'groups' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_groups_slug() ) || !bp_is_action_variable( 'feed', 0 ) ) 566 if ( ! bp_activity_do_mentions() ) { 567 return false; 568 } 569 570 if ( !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) ) 511 571 return false; 512 572 … … 514 574 status_header( 200 ); 515 575 516 include_once( 'feeds/bp-activity-m ygroups-feed.php' );576 include_once( 'feeds/bp-activity-mentions-feed.php' ); 517 577 die; 518 578 } 519 add_action( 'bp_actions', 'bp_activity_action_m y_groups_feed' );520 521 /** 522 * Load a user's @mentions feed.579 add_action( 'bp_actions', 'bp_activity_action_mentions_feed' ); 580 581 /** 582 * Load a user's favorites feed. 523 583 * 524 584 * @since BuddyPress (1.2) … … 532 592 * @return bool False on failure 533 593 */ 534 function bp_activity_action_mentions_feed() {535 global $wp_query;536 537 if ( ! bp_activity_do_mentions() ) {538 return false;539 }540 541 if ( !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) )542 return false;543 544 $wp_query->is_404 = false;545 status_header( 200 );546 547 include_once( 'feeds/bp-activity-mentions-feed.php' );548 die;549 }550 add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );551 552 /**553 * Load a user's favorites feed.554 *555 * @since BuddyPress (1.2)556 *557 * @global object $wp_query558 * @uses bp_is_user_activity()559 * @uses bp_is_current_action()560 * @uses bp_is_action_variable()561 * @uses status_header()562 *563 * @return bool False on failure564 */565 594 function bp_activity_action_favorites_feed() { 566 global $wp_query; 567 568 if ( !bp_is_user_activity() || !bp_is_current_action( 'favorites' ) || !bp_is_action_variable( 'feed', 0 ) ) 569 return false; 570 571 $wp_query->is_404 = false; 572 status_header( 200 ); 573 574 include_once( 'feeds/bp-activity-favorites-feed.php' ); 575 die; 595 if ( ! bp_is_user_activity() || ! bp_is_current_action( 'favorites' ) || ! bp_is_action_variable( 'feed', 0 ) ) { 596 return false; 597 } 598 599 // get displayed user's favorite activity IDs 600 $favs = bp_activity_get_user_favorites( bp_displayed_user_id() ); 601 $fav_ids = implode( ',', (array) $favs ); 602 603 // setup the feed 604 buddypress()->activity->feed = new BP_Activity_Feed( array( 605 'id' => 'favorites', 606 607 /* translators: User activity favorites RSS title - "[Site Name] | [User Display Name] | Favorites" */ 608 'title' => sprintf( __( '%1$s | %2$s | Favorites', 'buddypress' ), bp_get_site_name(), bp_get_displayed_user_fullname() ), 609 610 'link' => bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/', 611 'description' => sprintf( __( "Activity feed of %s' favorites.", 'buddypress' ), bp_get_displayed_user_fullname() ), 612 'activity_args' => 'include=' . $fav_ids 613 ) ); 576 614 } 577 615 add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
Note: See TracChangeset
for help on using the changeset viewer.