BuddyPress - Version 1.8-beta1

Version Description

= 1.7.2 = See: http://codex.buddypress.org/releases/version-1-7-2/

= 1.7.1 = See: http://codex.buddypress.org/releases/version-1-7-1/

= 1.7 = See: http://codex.buddypress.org/releases/version-1-7/

= 1.6.5 = See: http://codex.buddypress.org/releases/version-1-6-5/

= 1.6.4 = See: http://codex.buddypress.org/releases/version-1-6-4/

= 1.6.3 = See: http://codex.buddypress.org/releases/version-1-6-3/

= 1.6.2 = Compatibility with WordPress 3.5

= 1.6.1 = Fixes 4 bugs

= 1.6 = See: http://codex.buddypress.org/releases/version-1-6/

= 1.5 = See: http://codex.buddypress.org/releases/version-1-5/

= 1.2.9 = Compatibility with WordPress 3.2

= 1.2.8 = Compatibility with WordPress 3.1

= 1.2.7 = Fixes over 10 bugs.

Download this release

Release Info

Developer boonebgorges
Plugin Icon 128x128 BuddyPress
Version 1.8-beta1
Comparing to
See all releases

Code changes from version 1.7.2 to 1.8-beta1

Files changed (99) hide show
  1. bp-activity/bp-activity-actions.php +85 -44
  2. bp-activity/bp-activity-admin.php +7 -7
  3. bp-activity/bp-activity-cache.php +18 -1
  4. bp-activity/bp-activity-classes.php +350 -6
  5. bp-activity/bp-activity-filters.php +15 -0
  6. bp-activity/bp-activity-functions.php +32 -5
  7. bp-activity/bp-activity-loader.php +26 -20
  8. bp-activity/bp-activity-screens.php +68 -11
  9. bp-activity/bp-activity-template.php +53 -7
  10. bp-activity/feeds/bp-activity-favorites-feed.php +0 -74
  11. bp-activity/feeds/bp-activity-friends-feed.php +0 -64
  12. bp-activity/feeds/bp-activity-group-feed.php +0 -59
  13. bp-activity/feeds/bp-activity-mentions-feed.php +0 -65
  14. bp-activity/feeds/bp-activity-mygroups-feed.php +0 -65
  15. bp-activity/feeds/bp-activity-personal-feed.php +0 -64
  16. bp-activity/feeds/bp-activity-sitewide-feed.php +0 -59
  17. bp-blogs/bp-blogs-actions.php +1 -1
  18. bp-blogs/bp-blogs-functions.php +8 -9
  19. bp-blogs/bp-blogs-loader.php +9 -0
  20. bp-blogs/bp-blogs-screens.php +48 -0
  21. bp-blogs/bp-blogs-widgets.php +32 -9
  22. bp-core/admin/bp-core-functions.php +12 -0
  23. bp-core/bp-core-actions.php +2 -0
  24. bp-core/bp-core-admin.php +4 -4
  25. bp-core/bp-core-adminbar.php +1 -0
  26. bp-core/bp-core-avatars.php +83 -65
  27. bp-core/bp-core-buddybar.php +15 -18
  28. bp-core/bp-core-classes.php +73 -13
  29. bp-core/bp-core-component.php +58 -50
  30. bp-core/bp-core-dependency.php +10 -0
  31. bp-core/bp-core-functions.php +647 -564
  32. bp-core/bp-core-loader.php +3 -2
  33. bp-core/bp-core-options.php +3 -3
  34. bp-core/bp-core-template-loader.php +27 -11
  35. bp-core/bp-core-template.php +25 -14
  36. bp-core/bp-core-theme-compatibility.php +87 -89
  37. bp-core/bp-core-widgets.php +16 -10
  38. bp-core/deprecated/1.2.php +48 -0
  39. bp-forums/bp-forums-loader.php +6 -0
  40. bp-forums/deprecated/1.6.php +96 -8
  41. bp-forums/deprecated/1.7.php +0 -229
  42. bp-friends/bp-friends-functions.php +4 -0
  43. bp-groups/admin/css/admin.css +37 -0
  44. bp-groups/admin/css/admin.min.css +1 -1
  45. bp-groups/admin/js/admin.js +17 -1
  46. bp-groups/admin/js/admin.min.js +1 -1
  47. bp-groups/bp-groups-actions.php +28 -13
  48. bp-groups/bp-groups-admin.php +149 -59
  49. bp-groups/bp-groups-cache.php +6 -4
  50. bp-groups/bp-groups-classes.php +1578 -188
  51. bp-groups/bp-groups-functions.php +58 -16
  52. bp-groups/bp-groups-loader.php +11 -1
  53. bp-groups/bp-groups-screens.php +84 -3
  54. bp-groups/bp-groups-template.php +43 -23
  55. bp-groups/bp-groups-widgets.php +7 -5
  56. bp-languages/buddypress.pot +860 -838
  57. bp-loader.php +41 -24
  58. bp-members/bp-members-functions.php +114 -7
  59. bp-members/bp-members-notifications.php +1 -1
  60. bp-members/bp-members-screens.php +83 -2
  61. bp-members/bp-members-template.php +4 -3
  62. bp-messages/bp-messages-template.php +4 -2
  63. bp-messages/js/autocomplete/jquery.autocompletefb.js +2 -2
  64. bp-messages/js/autocomplete/jquery.autocompletefb.min.js +1 -1
  65. bp-templates/bp-legacy/buddypress-functions.php +109 -42
  66. bp-templates/bp-legacy/buddypress/activity/comment.php +1 -1
  67. bp-templates/bp-legacy/buddypress/activity/index.php +10 -6
  68. bp-templates/bp-legacy/buddypress/groups/single/admin.php +40 -40
  69. bp-templates/bp-legacy/buddypress/members/activate.php +1 -1
  70. bp-templates/bp-legacy/buddypress/members/index.php +2 -0
  71. bp-templates/bp-legacy/buddypress/members/register.php +8 -8
  72. bp-templates/bp-legacy/buddypress/members/single/home.php +1 -1
  73. bp-templates/bp-legacy/buddypress/members/single/profile.php +5 -11
  74. bp-templates/bp-legacy/buddypress/members/single/settings/capabilities.php +14 -26
  75. bp-templates/bp-legacy/buddypress/members/single/settings/delete-account.php +21 -33
  76. bp-templates/bp-legacy/buddypress/members/single/settings/general.php +19 -33
  77. bp-templates/bp-legacy/buddypress/members/single/settings/notifications.php +12 -26
  78. bp-templates/bp-legacy/css/buddypress.css +103 -114
  79. bp-templates/bp-legacy/js/buddypress.js +119 -34
  80. bp-themes/bp-default/_inc/ajax.php +17 -4
  81. bp-themes/bp-default/_inc/css/default.css +14 -0
  82. bp-themes/bp-default/_inc/global.js +94 -26
  83. bp-themes/bp-default/activity/comment.php +1 -1
  84. bp-themes/bp-default/activity/index.php +6 -2
  85. bp-themes/bp-default/comments.php +1 -1
  86. bp-themes/bp-default/functions.php +2 -1
  87. bp-themes/bp-default/groups/single/admin.php +40 -40
  88. bp-themes/bp-default/members/index.php +2 -0
  89. bp-themes/bp-default/members/single/profile.php +5 -11
  90. bp-themes/bp-default/members/single/settings/general.php +1 -1
  91. bp-themes/bp-default/registration/activate.php +1 -1
  92. bp-themes/bp-default/registration/register.php +9 -9
  93. bp-themes/bp-default/rtl.css +2 -2
  94. bp-themes/bp-default/style.css +2 -2
  95. bp-xprofile/admin/js/admin.js +6 -0
  96. bp-xprofile/admin/js/admin.min.js +1 -1
  97. bp-xprofile/bp-xprofile-admin.php +2 -2
  98. bp-xprofile/bp-xprofile-classes.php +5 -6
  99. bp-xprofile/bp-xprofile-template.php +34 -2
bp-activity/bp-activity-actions.php CHANGED
@@ -45,14 +45,13 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
45
* @return bool False on failure
46
*/
47
function bp_activity_action_permalink_router() {
48
- global $bp;
49
50
// Not viewing activity
51
- if ( !bp_is_activity_component() || !bp_is_current_action( 'p' ) )
52
return false;
53
54
// No activity to display
55
- if ( !bp_action_variable( 0 ) || !is_numeric( bp_action_variable( 0 ) ) )
56
return false;
57
58
// Get the activity details
@@ -62,7 +61,6 @@ function bp_activity_action_permalink_router() {
62
if ( empty( $activity['activities'][0] ) ) {
63
bp_do_404();
64
return;
65
-
66
} else {
67
$activity = $activity['activities'][0];
68
}
@@ -71,10 +69,10 @@ function bp_activity_action_permalink_router() {
71
$redirect = false;
72
73
// Redirect based on the type of activity
74
- if ( bp_is_active( 'groups' ) && $activity->component == $bp->groups->id ) {
75
76
// Activity is a user update
77
- if ( !empty( $activity->user_id ) ) {
78
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
79
80
// Activity is something else
@@ -87,20 +85,21 @@ function bp_activity_action_permalink_router() {
87
}
88
89
// Set redirect to users' activity stream
90
- } else {
91
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
92
}
93
94
// If set, add the original query string back onto the redirect URL
95
- if ( !empty( $_SERVER['QUERY_STRING'] ) ) {
96
$query_frags = array();
97
wp_parse_str( $_SERVER['QUERY_STRING'], $query_frags );
98
$redirect = add_query_arg( urlencode_deep( $query_frags ), $redirect );
99
}
100
101
// Allow redirect to be filtered
102
- if ( !$redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) )
103
bp_core_redirect( bp_get_root_domain() );
104
105
// Redirect to the actual activity permalink page
106
bp_core_redirect( $redirect );
@@ -422,16 +421,22 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
422
* @return bool False on failure
423
*/
424
function bp_activity_action_sitewide_feed() {
425
- global $bp, $wp_query;
426
427
- if ( !bp_is_activity_component() || !bp_is_current_action( 'feed' ) || bp_is_user() || !empty( $bp->groups->current_group ) )
428
return false;
429
430
- $wp_query->is_404 = false;
431
- status_header( 200 );
432
433
- include_once( 'feeds/bp-activity-sitewide-feed.php' );
434
- die;
435
}
436
add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
437
@@ -448,16 +453,21 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
448
* @return bool False on failure
449
*/
450
function bp_activity_action_personal_feed() {
451
- global $wp_query;
452
-
453
- if ( !bp_is_user_activity() || !bp_is_current_action( 'feed' ) )
454
return false;
455
456
- $wp_query->is_404 = false;
457
- status_header( 200 );
458
459
- include_once( 'feeds/bp-activity-personal-feed.php' );
460
- die;
461
}
462
add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
463
@@ -477,16 +487,21 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
477
* @return bool False on failure
478
*/
479
function bp_activity_action_friends_feed() {
480
- global $wp_query;
481
-
482
- if ( !bp_is_active( 'friends' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_friends_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
483
return false;
484
485
- $wp_query->is_404 = false;
486
- status_header( 200 );
487
488
- include_once( 'feeds/bp-activity-friends-feed.php' );
489
- die;
490
}
491
add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
492
@@ -506,16 +521,29 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
506
* @return bool False on failure
507
*/
508
function bp_activity_action_my_groups_feed() {
509
- global $wp_query;
510
-
511
- if ( !bp_is_active( 'groups' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_groups_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
512
return false;
513
514
- $wp_query->is_404 = false;
515
- status_header( 200 );
516
-
517
- include_once( 'feeds/bp-activity-mygroups-feed.php' );
518
- die;
519
}
520
add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
521
@@ -535,6 +563,10 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
535
function bp_activity_action_mentions_feed() {
536
global $wp_query;
537
538
if ( !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) )
539
return false;
540
@@ -560,16 +592,25 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
560
* @return bool False on failure
561
*/
562
function bp_activity_action_favorites_feed() {
563
- global $wp_query;
564
-
565
- if ( !bp_is_user_activity() || !bp_is_current_action( 'favorites' ) || !bp_is_action_variable( 'feed', 0 ) )
566
return false;
567
568
- $wp_query->is_404 = false;
569
- status_header( 200 );
570
571
- include_once( 'feeds/bp-activity-favorites-feed.php' );
572
- die;
573
}
574
add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
575
45
* @return bool False on failure
46
*/
47
function bp_activity_action_permalink_router() {
48
49
// Not viewing activity
50
+ if ( ! bp_is_activity_component() || ! bp_is_current_action( 'p' ) )
51
return false;
52
53
// No activity to display
54
+ if ( ! bp_action_variable( 0 ) || ! is_numeric( bp_action_variable( 0 ) ) )
55
return false;
56
57
// Get the activity details
61
if ( empty( $activity['activities'][0] ) ) {
62
bp_do_404();
63
return;
64
} else {
65
$activity = $activity['activities'][0];
66
}
69
$redirect = false;
70
71
// Redirect based on the type of activity
72
+ if ( bp_is_active( 'groups' ) && $activity->component == buddypress()->groups->id ) {
73
74
// Activity is a user update
75
+ if ( ! empty( $activity->user_id ) ) {
76
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
77
78
// Activity is something else
85
}
86
87
// Set redirect to users' activity stream
88
+ } else if ( ! empty( $activity->user_id ) ) {
89
$redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . bp_get_activity_slug() . '/' . $activity->id . '/';
90
}
91
92
// If set, add the original query string back onto the redirect URL
93
+ if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
94
$query_frags = array();
95
wp_parse_str( $_SERVER['QUERY_STRING'], $query_frags );
96
$redirect = add_query_arg( urlencode_deep( $query_frags ), $redirect );
97
}
98
99
// Allow redirect to be filtered
100
+ if ( ! $redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) ) {
101
bp_core_redirect( bp_get_root_domain() );
102
+ }
103
104
// Redirect to the actual activity permalink page
105
bp_core_redirect( $redirect );
421
* @return bool False on failure
422
*/
423
function bp_activity_action_sitewide_feed() {
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
+ ) );
440
}
441
add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
442
453
* @return bool False on failure
454
*/
455
function bp_activity_action_personal_feed() {
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
+ ) );
471
}
472
add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
473
487
* @return bool False on failure
488
*/
489
function bp_activity_action_friends_feed() {
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
+ ) );
505
}
506
add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
507
521
* @return bool False on failure
522
*/
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
563
function bp_activity_action_mentions_feed() {
564
global $wp_query;
565
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 ) )
571
return false;
572
592
* @return bool False on failure
593
*/
594
function bp_activity_action_favorites_feed() {
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
+ ) );
614
}
615
add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
616
bp-activity/bp-activity-admin.php CHANGED
@@ -588,7 +588,7 @@ function bp_activity_admin_edit() {
588
589
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
590
<div id="post-body-content">
591
- <div id="postdiv" class="postarea">
592
<div id="bp_activity_action" class="postbox">
593
<h3><?php _e( 'Action', 'buddypress' ); ?></h3>
594
<div class="inside">
@@ -1127,13 +1127,13 @@ class BP_Activity_List_Table extends WP_List_Table {
1127
* @since BuddyPress (1.6)
1128
*/
1129
function get_views() {
1130
- $redirect_to = remove_query_arg( array( 'activity_status', 'aid', 'deleted', 'error', 'spammed', 'unspammed', 'updated', ), $_SERVER['REQUEST_URI'] );
1131
- ?>
1132
<ul class="subsubsub">
1133
- <li class="all"><a href="<?php echo esc_attr( esc_url( $redirect_to ) ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
1134
- <li class="spam"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'activity_status', 'spam', $redirect_to ) ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
1135
1136
- <?php do_action( 'bp_activity_list_table_get_views', $redirect_to, $this->view ); ?>
1137
</ul>
1138
<?php
1139
}
@@ -1224,7 +1224,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1224
* @since BuddyPress (1.6)
1225
*/
1226
function column_cb( $item ) {
1227
- printf( '<input type="checkbox" name="aid[]" value="%d" />', (int) $item['id'] );
1228
}
1229
1230
/**
588
589
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
590
<div id="post-body-content">
591
+ <div id="postdiv">
592
<div id="bp_activity_action" class="postbox">
593
<h3><?php _e( 'Action', 'buddypress' ); ?></h3>
594
<div class="inside">
1127
* @since BuddyPress (1.6)
1128
*/
1129
function get_views() {
1130
+ $url_base = bp_get_admin_url( 'admin.php?page=bp-activity' ); ?>
1131
+
1132
<ul class="subsubsub">
1133
+ <li class="all"><a href="<?php echo esc_attr( esc_url( $url_base ) ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
1134
+ <li class="spam"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'activity_status', 'spam', $url_base ) ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
1135
1136
+ <?php do_action( 'bp_activity_list_table_get_views', $url_base, $this->view ); ?>
1137
</ul>
1138
<?php
1139
}
1224
* @since BuddyPress (1.6)
1225
*/
1226
function column_cb( $item ) {
1227
+ printf( '<label class="screen-reader-text" for="aid-%1$d">' . __( 'Select activity item %1$d', 'buddypress' ) . '</label><input type="checkbox" name="aid[]" value="%1$d" id="aid-%1$d" />', $item['id'] );
1228
}
1229
1230
/**
bp-activity/bp-activity-cache.php CHANGED
@@ -32,6 +32,23 @@ function bp_activity_update_meta_cache( $activity_ids = false ) {
32
'meta_table' => $bp->activity->table_name_meta,
33
'cache_key_prefix' => 'bp_activity_meta'
34
);
35
-
36
bp_update_meta_cache( $cache_args );
37
}
32
'meta_table' => $bp->activity->table_name_meta,
33
'cache_key_prefix' => 'bp_activity_meta'
34
);
35
+
36
bp_update_meta_cache( $cache_args );
37
}
38
+
39
+ /**
40
+ * Clear the cache for all metadata of a given activity
41
+ *
42
+ * @param int $activity_id
43
+ */
44
+ function bp_activity_clear_meta_cache_for_activity( $activity_id ) {
45
+ global $wp_object_cache;
46
+
47
+ if ( is_object( $wp_object_cache ) && ! empty( $wp_object_cache->cache['bp'] ) ) {
48
+ foreach ( $wp_object_cache->cache['bp'] as $ckey => $cvalue ) {
49
+ if ( 0 === strpos( $ckey, 'bp_activity_meta_' . $activity_id ) ) {
50
+ wp_cache_delete( $ckey, 'bp' );
51
+ }
52
+ }
53
+ }
54
+ }
bp-activity/bp-activity-classes.php CHANGED
@@ -144,6 +144,7 @@ class BP_Activity_Activity {
144
'sort' => 'DESC', // ASC or DESC
145
'exclude' => false, // Array of ids to exclude
146
'in' => false, // Array of ids to limit query by (IN)
147
'filter' => false, // See self::get_filter_sql()
148
'search_terms' => false, // Terms to search by
149
'display_comments' => false, // Whether to include activity comments
@@ -158,6 +159,8 @@ class BP_Activity_Activity {
158
159
$from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID";
160
161
// Where conditions
162
$where_conditions = array();
163
@@ -197,6 +200,17 @@ class BP_Activity_Activity {
197
$where_conditions['in'] = "a.id IN ({$in})";
198
}
199
200
// Alter the query based on whether we want to show activity item
201
// comments in the stream like normal comments or threaded below
202
// the activity.
@@ -228,12 +242,12 @@ class BP_Activity_Activity {
228
$per_page = absint( $per_page );
229
230
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page );
231
- $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
232
} else {
233
- $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort ) );
234
}
235
236
- $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $where_sql, $sort );
237
238
$total_activities = $wpdb->get_var( $total_activities_sql );
239
@@ -242,7 +256,7 @@ class BP_Activity_Activity {
242
$activity_user_ids = wp_list_pluck( $activities, 'user_id' );
243
$activity_user_ids = implode( ',', wp_parse_id_list( $activity_user_ids ) );
244
245
- if ( !empty( $activity_user_ids ) ) {
246
if ( $names = $wpdb->get_results( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) {
247
foreach ( (array) $names as $name )
248
$tmp_names[$name->user_id] = $name->user_fullname;
@@ -280,6 +294,46 @@ class BP_Activity_Activity {
280
return array( 'activities' => $activities, 'total' => (int) $total_activities );
281
}
282
283
/**
284
* In BuddyPress 1.2.x, this was used to retrieve specific activity stream items (for example, on an activity's permalink page).
285
* As of 1.5.x, use BP_Activity_Activity::get() with an 'in' parameter instead.
@@ -425,6 +479,10 @@ class BP_Activity_Activity {
425
426
$activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) );
427
428
return $wpdb->query( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" );
429
}
430
@@ -556,10 +614,14 @@ class BP_Activity_Activity {
556
return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d", $parent_id ) );
557
}
558
559
function get_recorded_components() {
560
global $wpdb, $bp;
561
-
562
- return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" ) );
563
}
564
565
function get_sitewide_items_for_feed( $limit = 35 ) {
@@ -668,3 +730,285 @@ class BP_Activity_Activity {
668
return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
669
}
670
}
144
'sort' => 'DESC', // ASC or DESC
145
'exclude' => false, // Array of ids to exclude
146
'in' => false, // Array of ids to limit query by (IN)
147
+ 'meta_query' => false, // Filter by activitymeta
148
'filter' => false, // See self::get_filter_sql()
149
'search_terms' => false, // Terms to search by
150
'display_comments' => false, // Whether to include activity comments
159
160
$from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID";
161
162
+ $join_sql = '';
163
+
164
// Where conditions
165
$where_conditions = array();
166
200
$where_conditions['in'] = "a.id IN ({$in})";
201
}
202
203
+ // Process meta_query into SQL
204
+ $meta_query_sql = self::get_meta_query_sql( $meta_query );
205
+
206
+ if ( ! empty( $meta_query_sql['join'] ) ) {
207
+ $join_sql .= $meta_query_sql['join'];
208
+ }
209
+
210
+ if ( ! empty( $meta_query_sql['where'] ) ) {
211
+ $where_conditions[] = $meta_query_sql['where'];
212
+ }
213
+
214
// Alter the query based on whether we want to show activity item
215
// comments in the stream like normal comments or threaded below
216
// the activity.
242
$per_page = absint( $per_page );
243
244
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page );
245
+ $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
246
} else {
247
+ $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort ) );
248
}
249
250
+ $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $where_sql, $sort );
251
252
$total_activities = $wpdb->get_var( $total_activities_sql );
253
256
$activity_user_ids = wp_list_pluck( $activities, 'user_id' );
257
$activity_user_ids = implode( ',', wp_parse_id_list( $activity_user_ids ) );
258
259
+ if ( !empty( $activity_user_ids ) ) {
260
if ( $names = $wpdb->get_results( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) {
261
foreach ( (array) $names as $name )
262
$tmp_names[$name->user_id] = $name->user_fullname;
294
return array( 'activities' => $activities, 'total' => (int) $total_activities );
295
}
296
297
+ /**
298
+ * Get the SQL for the 'meta_query' param in BP_Activity_Activity::get()
299
+ *
300
+ * We use WP_Meta_Query to do the heavy lifting of parsing the
301
+ * meta_query array and creating the necessary SQL clauses. However,
302
+ * since BP_Activity_Activity::get() builds its SQL differently than
303
+ * WP_Query, we have to alter the return value (stripping the leading
304
+ * AND keyword from the 'where' clause).
305
+ *
306
+ * @since 1.8
307
+ *
308
+ * @param array $meta_query An array of meta_query filters. See the
309
+ * documentation for WP_Meta_Query for details.
310
+ * @return array $sql_array 'join' and 'where' clauses
311
+ */
312
+ public static function get_meta_query_sql( $meta_query = array() ) {
313
+ global $wpdb;
314
+
315
+ $sql_array = array(
316
+ 'join' => '',
317
+ 'where' => '',
318
+ );
319
+
320
+ if ( ! empty( $meta_query ) ) {
321
+ $activity_meta_query = new WP_Meta_Query( $meta_query );
322
+
323
+ // WP_Meta_Query expects the table name at
324
+ // $wpdb->activitymeta
325
+ $wpdb->activitymeta = buddypress()->activity->table_name_meta;
326
+
327
+ $meta_sql = $activity_meta_query->get_sql( 'activity', 'a', 'id' );
328
+
329
+ // Strip the leading AND - BP handles it in get()
330
+ $sql_array['where'] = preg_replace( '/^\sAND/', '', $meta_sql['where'] );
331
+ $sql_array['join'] = $meta_sql['join'];
332
+ }
333
+
334
+ return $sql_array;
335
+ }
336
+
337
/**
338
* In BuddyPress 1.2.x, this was used to retrieve specific activity stream items (for example, on an activity's permalink page).
339
* As of 1.5.x, use BP_Activity_Activity::get() with an 'in' parameter instead.
479
480
$activity_ids = implode( ',', wp_parse_id_list( $activity_ids ) );
481
482
+ foreach ( (array) $activity_ids as $activity_id ) {
483
+ bp_activity_clear_meta_cache_for_activity( $activity_id );
484
+ }
485
+
486
return $wpdb->query( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" );
487
}
488
614
return $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND secondary_item_id = %d", $parent_id ) );
615
}
616
617
+ /**
618
+ * Fetch a list of all components that have activity items recorded
619
+ *
620
+ * @return array
621
+ */
622
function get_recorded_components() {
623
global $wpdb, $bp;
624
+ return $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" );
625
}
626
627
function get_sitewide_items_for_feed( $limit = 35 ) {
730
return $wpdb->get_var( $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET hide_sitewide = 1 WHERE user_id = %d", $user_id ) );
731
}
732
}
733
+
734
+ /**
735
+ * Create a RSS feed using the activity component.
736
+ *
737
+ * You should only construct a new feed when you've validated that you're on
738
+ * the appropriate screen.
739
+ *
740
+ * See {@link bp_activity_action_sitewide_feed()} as an example.
741
+ *
742
+ * Accepted parameters:
743
+ * id - internal id for the feed; should be alphanumeric only
744
+ * (required)
745
+ * title - RSS feed title
746
+ * link - Relevant link for the RSS feed
747
+ * description - RSS feed description
748
+ * ttl - Time-to-live (see inline doc in constructor)
749
+ * update_period - Part of the syndication module (see inline doc in
750
+ * constructor for more info)
751
+ * update_frequency - Part of the syndication module (see inline doc in
752
+ * constructor for more info)
753
+ * max - Number of feed items to display
754
+ * activity_args - Arguments passed to {@link bp_has_activities()}
755
+ *
756
+ * @since BuddyPress (1.8)
757
+ */
758
+ class BP_Activity_Feed {
759
+ /**
760
+ * Holds our custom class properties.
761
+ *
762
+ * These variables are stored in a protected array that is magically
763
+ * updated using PHP 5.2+ methods.
764
+ *
765
+ * @see BP_Feed::__construct() This is where $data is added
766
+ * @var array
767
+ */
768
+ protected $data;
769
+
770
+ /**
771
+ * Magic method for checking the existence of a certain data variable.
772
+ *
773
+ * @param string $key
774
+ */
775
+ public function __isset( $key ) { return isset( $this->data[$key] ); }
776
+
777
+ /**
778
+ * Magic method for getting a certain data variable.
779
+ *
780
+ * @param string $key
781
+ */
782
+ public function __get( $key ) { return isset( $this->data[$key] ) ? $this->data[$key] : null; }
783
+
784
+ /**
785
+ * Constructor.
786
+ *
787
+ * @param $args Array
788
+ */
789
+ public function __construct( $args = array() ) {
790
+ // If feeds are disabled, stop now!
791
+ if ( false === (bool) apply_filters( 'bp_activity_enable_feeds', true ) ) {
792
+ global $wp_query;
793
+
794
+ // set feed flag to false
795
+ $wp_query->is_feed = false;
796
+
797
+ return false;
798
+ }
799
+
800
+ // Setup data
801
+ $this->data = wp_parse_args( $args, array(
802
+ // Internal identifier for the RSS feed - should be alphanumeric only
803
+ 'id' => '',
804
+
805
+ // RSS title - should be plain-text
806
+ 'title' => '',
807
+
808
+ // relevant link for the RSS feed
809
+ 'link' => '',
810
+
811
+ // RSS description - should be plain-text
812
+ 'description' => '',
813
+
814
+ // Time-to-live - number of minutes to cache the data before an aggregator
815
+ // requests it again. This is only acknowledged if the RSS client supports it
816
+ //
817
+ // See: http://www.rssboard.org/rss-profile#element-channel-ttl
818
+ // http://www.kbcafe.com/rss/rssfeedstate.html#ttl
819
+ 'ttl' => '30',
820
+
821
+ // Syndication module - similar to ttl, but not really supported by RSS
822
+ // clients
823
+ //
824
+ // See: http://web.resource.org/rss/1.0/modules/syndication/#description
825
+ // http://www.kbcafe.com/rss/rssfeedstate.html#syndicationmodule
826
+ 'update_period' => 'hourly',
827
+ 'update_frequency' => 2,
828
+
829
+ // Number of items to display
830
+ 'max' => 50,
831
+
832
+ // Activity arguments passed to bp_has_activities()
833
+ 'activity_args' => array()
834
+ ) );
835
+
836
+ // Plugins can use this filter to modify the feed before it is setup
837
+ do_action_ref_array( 'bp_activity_feed_prefetch', array( &$this ) );
838
+
839
+ // Setup class properties
840
+ $this->setup_properties();
841
+
842
+ // Check if id is valid
843
+ if ( empty( $this->id ) ) {
844
+ _doing_it_wrong( 'BP_Activity_Feed', __( "RSS feed 'id' must be defined", 'buddypress' ), 'BP 1.8' );
845
+ return false;
846
+ }
847
+
848
+ // Plugins can use this filter to modify the feed after it's setup
849
+ do_action_ref_array( 'bp_activity_feed_postfetch', array( &$this ) );
850
+
851
+ // Setup feed hooks
852
+ $this->setup_hooks();
853
+
854
+ // Output the feed
855
+ $this->output();
856
+
857
+ // Kill the rest of the output
858
+ die();
859
+ }
860
+
861
+ /** SETUP ****************************************************************/
862
+
863
+ /**
864
+ * Setup and validate the class properties.
865
+ */
866
+ protected function setup_properties() {
867
+ $this->id = sanitize_title( $this->id );
868
+ $this->title = strip_tags( $this->title );
869
+ $this->link = esc_url_raw( $this->link );
870
+ $this->description = strip_tags( $this->description );
871
+ $this->ttl = (int) $this->ttl;
872
+ $this->update_period = strip_tags( $this->update_period );
873
+ $this->update_frequency = (int) $this->update_frequency;
874
+
875
+ $this->activity_args = wp_parse_args( $this->activity_args, array(
876
+ 'max' => $this->max,
877
+ 'display_comments' => 'stream'
878
+ ) );
879
+
880
+ }
881
+
882
+ /**
883
+ * Setup some hooks that are used in the feed.
884
+ *
885
+ * Currently, these hooks are used to maintain backwards compatibility with
886
+ * the RSS feeds previous to BP 1.8.
887
+ */
888
+ protected function setup_hooks() {
889
+ add_action( 'bp_activity_feed_rss_attributes', array( $this, 'backpat_rss_attributes' ) );
890
+ add_action( 'bp_activity_feed_channel_elements', array( $this, 'backpat_channel_elements' ) );
891
+ add_action( 'bp_activity_feed_item_elements', array( $this, 'backpat_item_elements' ) );
892
+ }
893
+
894
+ /** BACKPAT HOOKS ********************************************************/
895
+
896
+ public function backpat_rss_attributes() {
897
+ do_action( 'bp_activity_' . $this->id . '_feed' );
898
+ }
899
+
900
+ public function backpat_channel_elements() {
901
+ do_action( 'bp_activity_' . $this->id . '_feed_head' );
902
+ }
903
+
904
+ public function backpat_item_elements() {
905
+ switch ( $this->id ) {
906
+
907
+ // sitewide and friends feeds use the 'personal' hook
908
+ case 'sitewide' :
909
+ case 'friends' :
910
+ $id = 'personal';
911
+
912
+ break;
913
+
914
+ default :
915
+ $id = $this->id;
916
+
917
+ break;
918
+ }
919
+
920
+ do_action( 'bp_activity_' . $id . '_feed_item' );
921
+ }
922
+
923
+ /** HELPERS **************************************************************/
924
+
925
+ /**
926
+ * Output the feed's item content.
927
+ */
928
+ protected function feed_content() {
929
+ bp_activity_content_body();
930
+
931
+ switch ( $this->id ) {
932
+
933
+ // also output parent activity item if we're on a specific feed
934
+ case 'favorites' :
935
+ case 'friends' :
936
+ case 'mentions' :
937
+ case 'personal' :
938
+
939
+ if ( 'activity_comment' == bp_get_activity_action_name() ) :
940
+ ?>
941
+ <strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
942
+ <?php bp_activity_parent_content() ?>
943
+ <?php
944
+ endif;
945
+
946
+ break;
947
+ }
948
+ }
949
+
950
+ /** OUTPUT ***************************************************************/
951
+
952
+ /**
953
+ * Output the RSS feed.
954
+ */
955
+ protected function output() {
956
+ // set up some additional headers if not on a directory page
957
+ // this is done b/c BP uses pseudo-pages
958
+ if ( ! bp_is_directory() ) {
959
+ global $wp_query;
960
+
961
+ $wp_query->is_404 = false;
962
+ status_header( 200 );
963
+ }
964
+
965
+ header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
966
+ echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?'.'>';
967
+ ?>
968
+
969
+ <rss version="2.0"
970
+ xmlns:content="http://purl.org/rss/1.0/modules/content/"
971
+ xmlns:atom="http://www.w3.org/2005/Atom"
972
+ xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
973
+ xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
974
+ <?php do_action( 'bp_activity_feed_rss_attributes' ); ?>
975
+ >
976
+
977
+ <channel>
978
+ <title><?php echo $this->title; ?></title>
979
+ <link><?php echo $this->link; ?></link>
980
+ <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
981
+ <description><?php echo $this->description ?></description>
982
+ <lastBuildDate><?php echo mysql2date( 'D, d M Y H:i:s O', bp_activity_get_last_updated(), false ); ?></lastBuildDate>
983
+ <generator>http://buddypress.org/?v=<?php bp_version(); ?></generator>
984
+ <language><?php bloginfo_rss( 'language' ); ?></language>
985
+ <ttl><?php echo $this->ttl; ?></ttl>
986
+ <sy:updatePeriod><?php echo $this->update_period; ?></sy:updatePeriod>
987
+ <sy:updateFrequency><?php echo $this->update_frequency; ?></sy:updateFrequency>
988
+ <?php do_action( 'bp_activity_feed_channel_elements' ); ?>
989
+
990
+ <?php if ( bp_has_activities( $this->activity_args ) ) : ?>
991
+ <?php while ( bp_activities() ) : bp_the_activity(); ?>
992
+ <item>
993
+ <guid isPermaLink="false"><?php bp_activity_feed_item_guid(); ?></guid>
994
+ <title><?php echo stripslashes( bp_get_activity_feed_item_title() ); ?></title>
995
+ <link><?php bp_activity_thread_permalink() ?></link>
996
+ <pubDate><?php echo mysql2date( 'D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false ); ?></pubDate>
997
+
998
+ <?php if ( bp_get_activity_feed_item_description() ) : ?>
999
+ <content:encoded><![CDATA[<?php $this->feed_content(); ?>]]></content:encoded>
1000
+ <?php endif; ?>
1001
+
1002
+ <?php if ( bp_activity_can_comment() ) : ?>
1003
+ <slash:comments><?php bp_activity_comment_count(); ?></slash:comments>
1004
+ <?php endif; ?>
1005
+
1006
+ <?php do_action( 'bp_activity_feed_item_elements' ); ?>
1007
+ </item>
1008
+ <?php endwhile; ?>
1009
+
1010
+ <?php endif; ?>
1011
+ </channel>
1012
+ </rss><?php
1013
+ }
1014
+ }
bp-activity/bp-activity-filters.php CHANGED
@@ -208,6 +208,11 @@ function bp_activity_filter_kses( $content ) {
208
*/
209
function bp_activity_at_name_filter( $content, $activity_id = 0 ) {
210
211
// Try to find mentions
212
$usernames = bp_activity_find_mentions( $content );
213
@@ -237,6 +242,11 @@ function bp_activity_at_name_filter( $content, $activity_id = 0 ) {
237
* @uses bp_activity_find_mentions()
238
*/
239
function bp_activity_at_name_filter_updates( $activity ) {
240
// If activity was marked as spam, stop the rest of this function.
241
if ( ! empty( $activity->is_spam ) )
242
return;
@@ -271,6 +281,11 @@ function bp_activity_at_name_filter_updates( $activity ) {
271
* @uses bp_activity_update_mention_count_for_user()
272
*/
273
function bp_activity_at_name_send_emails( $activity ) {
274
// If our temporary variable doesn't exist, stop now.
275
if ( empty( buddypress()->activity->mentioned_users ) )
276
return;
208
*/
209
function bp_activity_at_name_filter( $content, $activity_id = 0 ) {
210
211
+ // Are mentions disabled?
212
+ if ( ! bp_activity_do_mentions() ) {
213
+ return $content;
214
+ }
215
+
216
// Try to find mentions
217
$usernames = bp_activity_find_mentions( $content );
218
242
* @uses bp_activity_find_mentions()
243
*/
244
function bp_activity_at_name_filter_updates( $activity ) {
245
+ // Are mentions disabled?
246
+ if ( ! bp_activity_do_mentions() ) {
247
+ return;
248
+ }
249
+
250
// If activity was marked as spam, stop the rest of this function.
251
if ( ! empty( $activity->is_spam ) )
252
return;
281
* @uses bp_activity_update_mention_count_for_user()
282
*/
283
function bp_activity_at_name_send_emails( $activity ) {
284
+ // Are mentions disabled?
285
+ if ( ! bp_activity_do_mentions() ) {
286
+ return;
287
+ }
288
+
289
// If our temporary variable doesn't exist, stop now.
290
if ( empty( buddypress()->activity->mentioned_users ) )
291
return;
bp-activity/bp-activity-functions.php CHANGED
@@ -27,6 +27,30 @@ function bp_activity_has_directory() {
27
return (bool) !empty( $bp->pages->activity->id );
28
}
29
30
/**
31
* Searches through the content of an activity item to locate usernames,
32
* designated by an @ sign.
@@ -367,7 +391,7 @@ function bp_activity_add_user_favorite( $activity_id, $user_id = 0 ) {
367
$user_id = bp_loggedin_user_id();
368
369
// Update the user's personal favorites
370
- $my_favs = bp_get_user_meta( bp_loggedin_user_id(), 'bp_favorite_activities', true );
371
$my_favs[] = $activity_id;
372
373
// Update the total number of users who have favorited this activity
@@ -375,7 +399,7 @@ function bp_activity_add_user_favorite( $activity_id, $user_id = 0 ) {
375
$fav_count = !empty( $fav_count ) ? (int) $fav_count + 1 : 1;
376
377
// Update user meta
378
- bp_update_user_meta( bp_loggedin_user_id(), 'bp_favorite_activities', $my_favs );
379
380
// Update activity meta counts
381
if ( true === bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ) ) {
@@ -881,6 +905,7 @@ function bp_activity_get( $args = '' ) {
881
'display_comments' => false, // false for no comments. 'stream' for within stream display, 'threaded' for below each activity item
882
883
'search_terms' => false, // Pass search terms as a string
884
'show_hidden' => false, // Show activity items that are hidden site-wide?
885
'exclude' => false, // Comma-separated list of activity IDs to exclude
886
'in' => false, // Comma-separated list or array of activity IDs to which you want to limit the query
@@ -902,7 +927,7 @@ function bp_activity_get( $args = '' ) {
902
extract( $r, EXTR_SKIP );
903
904
// Attempt to return a cached copy of the first page of sitewide activity.
905
- if ( 1 == (int) $page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && empty( $exclude ) && empty( $in ) && 'DESC' == $sort && empty( $exclude ) && 'ham_only' == $spam ) {
906
if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) {
907
$args = array(
908
'page' => $page,
@@ -910,6 +935,7 @@ function bp_activity_get( $args = '' ) {
910
'max' => $max,
911
'sort' => $sort,
912
'search_terms' => $search_terms,
913
'filter' => $filter,
914
'display_comments' => $display_comments,
915
'show_hidden' => $show_hidden,
@@ -926,6 +952,7 @@ function bp_activity_get( $args = '' ) {
926
'max' => $max,
927
'sort' => $sort,
928
'search_terms' => $search_terms,
929
'filter' => $filter,
930
'display_comments' => $display_comments,
931
'show_hidden' => $show_hidden,
@@ -1103,10 +1130,10 @@ function bp_activity_post_update( $args = '' ) {
1103
'type' => 'activity_update'
1104
) );
1105
1106
- $activity_content = apply_filters( 'bp_activity_latest_update_content', $content );
1107
1108
// Add this update to the "latest update" usermeta so it can be fetched anywhere.
1109
- bp_update_user_meta( bp_loggedin_user_id(), 'bp_latest_update', array( 'id' => $activity_id, 'content' => $content ) );
1110
1111
do_action( 'bp_activity_posted_update', $content, $user_id, $activity_id );
1112
27
return (bool) !empty( $bp->pages->activity->id );
28
}
29
30
+ /**
31
+ * Are mentions enabled or disabled?
32
+ *
33
+ * The Mentions feature does a number of things, all of which will be turned
34
+ * off if you disable mentions:
35
+ * - Detecting and auto-linking @username in all BP/WP content
36
+ * - Sending BP notifications and emails to users when they are mentioned
37
+ * using the @username syntax
38
+ * - The Public Message button on user profiles
39
+ *
40
+ * Mentions are enabled by default. To disable, put the following line in
41
+ * bp-custom.php or your theme's functions.php file:
42
+ *
43
+ * add_filter( 'bp_activity_do_mentions', '__return_false' );
44
+ *
45
+ * @since BuddyPress (1.8)
46
+ *
47
+ * @uses apply_filters() To call 'bp_activity_do_mentions' hook.
48
+ * @return bool $retval True to enable mentions, false to disable.
49
+ */
50
+ function bp_activity_do_mentions() {
51
+ return (bool) apply_filters( 'bp_activity_do_mentions', true );
52
+ }
53
+
54
/**
55
* Searches through the content of an activity item to locate usernames,
56
* designated by an @ sign.
391
$user_id = bp_loggedin_user_id();
392
393
// Update the user's personal favorites
394
+ $my_favs = bp_get_user_meta( $user_id, 'bp_favorite_activities', true );
395
$my_favs[] = $activity_id;
396
397
// Update the total number of users who have favorited this activity
399
$fav_count = !empty( $fav_count ) ? (int) $fav_count + 1 : 1;
400
401
// Update user meta
402
+ bp_update_user_meta( $user_id, 'bp_favorite_activities', $my_favs );
403
404
// Update activity meta counts
405
if ( true === bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ) ) {
905
'display_comments' => false, // false for no comments. 'stream' for within stream display, 'threaded' for below each activity item
906
907
'search_terms' => false, // Pass search terms as a string
908
+ 'meta_query' => false, // Filter by activity meta. See WP_Meta_Query for format
909
'show_hidden' => false, // Show activity items that are hidden site-wide?
910
'exclude' => false, // Comma-separated list of activity IDs to exclude
911
'in' => false, // Comma-separated list or array of activity IDs to which you want to limit the query
927
extract( $r, EXTR_SKIP );
928
929
// Attempt to return a cached copy of the first page of sitewide activity.
930
+ if ( 1 == (int) $page && empty( $max ) && empty( $search_terms ) && empty( $meta_query ) && empty( $filter ) && empty( $exclude ) && empty( $in ) && 'DESC' == $sort && empty( $exclude ) && 'ham_only' == $spam ) {
931
if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) {
932
$args = array(
933
'page' => $page,
935
'max' => $max,
936
'sort' => $sort,
937
'search_terms' => $search_terms,
938
+ 'meta_query' => $meta_query,
939
'filter' => $filter,
940
'display_comments' => $display_comments,
941
'show_hidden' => $show_hidden,
952
'max' => $max,
953
'sort' => $sort,
954
'search_terms' => $search_terms,
955
+ 'meta_query' => $meta_query,
956
'filter' => $filter,
957
'display_comments' => $display_comments,
958
'show_hidden' => $show_hidden,
1130
'type' => 'activity_update'
1131
) );
1132
1133
+ $activity_content = apply_filters( 'bp_activity_latest_update_content', $content, $activity_content );
1134
1135
// Add this update to the "latest update" usermeta so it can be fetched anywhere.
1136
+ bp_update_user_meta( bp_loggedin_user_id(), 'bp_latest_update', array( 'id' => $activity_id, 'content' => $activity_content ) );
1137
1138
do_action( 'bp_activity_posted_update', $content, $user_id, $activity_id );
1139
bp-activity/bp-activity-loader.php CHANGED
@@ -150,15 +150,17 @@ class BP_Activity_Component extends BP_Component {
150
);
151
152
// @ mentions
153
- $sub_nav[] = array(
154
- 'name' => __( 'Mentions', 'buddypress' ),
155
- 'slug' => 'mentions',
156
- 'parent_url' => $activity_link,
157
- 'parent_slug' => $this->slug,
158
- 'screen_function' => 'bp_activity_screen_mentions',
159
- 'position' => 20,
160
- 'item_css_id' => 'activity-mentions'
161
- );
162
163
// Favorite activity items
164
$sub_nav[] = array(
@@ -228,11 +230,13 @@ class BP_Activity_Component extends BP_Component {
228
$activity_link = trailingslashit( $user_domain . $this->slug );
229
230
// Unread message count
231
- $count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() );
232
- if ( !empty( $count ) ) {
233
- $title = sprintf( __( 'Mentions <span class="count">%s</span>', 'buddypress' ), number_format_i18n( $count ) );
234
- } else {
235
- $title = __( 'Mentions', 'buddypress' );
236
}
237
238
// Add the "Activity" sub menu
@@ -244,12 +248,14 @@ class BP_Activity_Component extends BP_Component {
244
);
245
246
// Mentions
247
- $wp_admin_nav[] = array(
248
- 'parent' => 'my-account-' . $this->id,
249
- 'id' => 'my-account-' . $this->id . '-mentions',
250
- 'title' => $title,
251
- 'href' => trailingslashit( $activity_link . 'mentions' )
252
- );
253
254
// Personal
255
$wp_admin_nav[] = array(
150
);
151
152
// @ mentions
153
+ if ( bp_activity_do_mentions() ) {
154
+ $sub_nav[] = array(
155
+ 'name' => __( 'Mentions', 'buddypress' ),
156
+ 'slug' => 'mentions',
157
+ 'parent_url' => $activity_link,
158
+ 'parent_slug' => $this->slug,
159
+ 'screen_function' => 'bp_activity_screen_mentions',
160
+ 'position' => 20,
161
+ 'item_css_id' => 'activity-mentions'
162
+ );
163
+ }
164
165
// Favorite activity items
166
$sub_nav[] = array(
230
$activity_link = trailingslashit( $user_domain . $this->slug );
231
232
// Unread message count
233
+ if ( bp_activity_do_mentions() ) {
234
+ $count = bp_get_total_mention_count_for_user( bp_loggedin_user_id() );
235
+ if ( !empty( $count ) ) {
236
+ $title = sprintf( __( 'Mentions <span class="count">%s</span>', 'buddypress' ), number_format_i18n( $count ) );
237
+ } else {
238
+ $title = __( 'Mentions', 'buddypress' );
239
+ }
240
}
241
242
// Add the "Activity" sub menu
248
);
249
250
// Mentions
251
+ if ( bp_activity_do_mentions() ) {
252
+ $wp_admin_nav[] = array(
253
+ 'parent' => 'my-account-' . $this->id,
254
+ 'id' => 'my-account-' . $this->id . '-mentions',
255
+ 'title' => $title,
256
+ 'href' => trailingslashit( $activity_link . 'mentions' )
257
+ );
258
+ }
259
260
// Personal
261
$wp_admin_nav[] = array(
bp-activity/bp-activity-screens.php CHANGED
@@ -265,11 +265,17 @@ add_action( 'bp_screens', 'bp_activity_screen_single_activity_permalink' );
265
*/
266
function bp_activity_screen_notification_settings() {
267
268
- if ( !$mention = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_mention', true ) )
269
- $mention = 'yes';
270
271
- if ( !$reply = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_reply', true ) )
272
- $reply = 'yes'; ?>
273
274
<table class="notification-settings" id="activity-notification-settings">
275
<thead>
@@ -282,12 +288,15 @@ function bp_activity_screen_notification_settings() {
282
</thead>
283
284
<tbody>
285
- <tr id="activity-notification-settings-mentions">
286
- <td>&nbsp;</td>
287
- <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( bp_displayed_user_id() ) ) ?></td>
288
- <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php checked( $mention, 'yes', true ) ?>/></td>
289
- <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php checked( $mention, 'no', true ) ?>/></td>
290
- </tr>
291
<tr id="activity-notification-settings-replies">
292
<td>&nbsp;</td>
293
<td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td>
@@ -309,7 +318,7 @@ add_action( 'bp_notification_settings', 'bp_activity_screen_notification_setting
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
*/
@@ -341,11 +350,13 @@ class BP_Activity_Theme_Compat {
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
// Single activity
348
} elseif ( bp_is_single_activity() ) {
349
add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) );
350
add_filter( 'bp_replace_the_content', array( $this, 'single_dummy_content' ) );
351
}
@@ -353,6 +364,29 @@ class BP_Activity_Theme_Compat {
353
354
/** Directory *************************************************************/
355
356
/**
357
* Update the global $post with directory data
358
*
@@ -383,6 +417,29 @@ class BP_Activity_Theme_Compat {
383
384
/** Single ****************************************************************/
385
386
/**
387
* Update the global $post with the displayed user's data
388
*
265
*/
266
function bp_activity_screen_notification_settings() {
267
268
+ if ( bp_activity_do_mentions() ) {
269
+ if ( ! $mention = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_mention', true ) ) {
270
+ $mention = 'yes';
271
+ }
272
+ }
273
+
274
+ if ( ! $reply = bp_get_user_meta( bp_displayed_user_id(), 'notification_activity_new_reply', true ) ) {
275
+ $reply = 'yes';
276
+ }
277
278
+ ?>
279
280
<table class="notification-settings" id="activity-notification-settings">
281
<thead>
288
</thead>
289
290
<tbody>
291
+ <?php if ( bp_activity_do_mentions() ) : ?>
292
+ <tr id="activity-notification-settings-mentions">
293
+ <td>&nbsp;</td>
294
+ <td><?php printf( __( 'A member mentions you in an update using "@%s"', 'buddypress' ), bp_core_get_username( bp_displayed_user_id() ) ) ?></td>
295
+ <td class="yes"><input type="radio" name="notifications[notification_activity_new_mention]" value="yes" <?php checked( $mention, 'yes', true ) ?>/></td>
296
+ <td class="no"><input type="radio" name="notifications[notification_activity_new_mention]" value="no" <?php checked( $mention, 'no', true ) ?>/></td>
297
+ </tr>
298
+ <?php endif; ?>
299
+
300
<tr id="activity-notification-settings-replies">
301
<td>&nbsp;</td>
302
<td><?php _e( "A member replies to an update or comment you've posted", 'buddypress' ) ?></td>
318
* The main theme compat class for BuddyPress Activity
319
*
320
* This class sets up the necessary theme compatability actions to safely output
321
+ * activity template parts to the_title and the_content areas of a theme.
322
*
323
* @since BuddyPress (1.7)
324
*/
350
351
do_action( 'bp_activity_screen_index' );
352
353
+ add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );
354
add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) );
355
add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) );
356
357
// Single activity
358
} elseif ( bp_is_single_activity() ) {
359
+ add_filter( 'bp_get_buddypress_template', array( $this, 'single_template_hierarchy' ) );
360
add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post' ) );
361
add_filter( 'bp_replace_the_content', array( $this, 'single_dummy_content' ) );
362
}
364
365
/** Directory *************************************************************/
366
367
+ /**
368
+ * Add template hierarchy to theme compat for the activity directory page.
369
+ *
370
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
371
+ *
372
+ * @since BuddyPress (1.8)
373
+ *
374
+ * @param string $templates The templates from bp_get_theme_compat_templates()
375
+ * @return array $templates Array of custom templates to look for.
376
+ */
377
+ public function directory_template_hierarchy( $templates ) {
378
+ // Setup our templates based on priority
379
+ $new_templates = apply_filters( 'bp_template_hierarchy_activity_directory', array(
380
+ 'activity/index-directory.php'
381
+ ) );
382
+
383
+ // Merge new templates with existing stack
384
+ // @see bp_get_theme_compat_templates()
385
+ $templates = array_merge( (array) $new_templates, $templates );
386
+
387
+ return $templates;
388
+ }
389
+
390
/**
391
* Update the global $post with directory data
392
*
417
418
/** Single ****************************************************************/
419
420
+ /**
421
+ * Add custom template hierarchy to theme compat for activity permalink pages.
422
+ *
423
+ * This is to mirror how WordPress has {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
424
+ *
425
+ * @since BuddyPress (1.8)
426
+ *
427
+ * @param string $templates The templates from bp_get_theme_compat_templates()
428
+ * @return array $templates Array of custom templates to look for.
429
+ */
430
+ public function single_template_hierarchy( $templates ) {
431
+ // Setup our templates based on priority
432
+ $new_templates = apply_filters( 'bp_template_hierarchy_activity_single_item', array(
433
+ 'activity/single/index.php'
434
+ ) );
435
+
436
+ // Merge new templates with existing stack
437
+ // @see bp_get_theme_compat_templates()
438
+ $templates = array_merge( (array) $new_templates, $templates );
439
+
440
+ return $templates;
441
+ }
442
+
443
/**
444
* Update the global $post with the displayed user's data
445
*
bp-activity/bp-activity-template.php CHANGED
@@ -150,6 +150,7 @@ class BP_Activity_Template {
150
'in' => false,
151
'filter' => false,
152
'search_terms' => false,
153
'display_comments' => 'threaded',
154
'show_hidden' => false,
155
'spam' => 'ham_only',
@@ -172,7 +173,7 @@ class BP_Activity_Template {
172
173
// Fetch all activity items
174
else
175
- $this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in, 'spam' => $spam ) );
176
177
if ( !$max || $max >= (int) $this->activities['total'] )
178
$this->total_activity_count = (int) $this->activities['total'];
@@ -361,6 +362,8 @@ function bp_has_activities( $args = '' ) {
361
'primary_id' => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
362
'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
363
364
// Searching
365
'search_terms' => false // specify terms to search on
366
);
@@ -410,11 +413,17 @@ function bp_has_activities( $args = '' ) {
410
if ( empty( $favs ) )
411
return false;
412
413
- $include = implode( ',', (array) $favs );
414
$display_comments = true;
415
break;
416
case 'mentions':
417
418
// Start search at @ symbol and stop search at closing tag delimiter.
419
$search_terms = '@' . bp_core_get_username( $user_id ) . '<';
420
$display_comments = 'stream';
@@ -453,6 +462,7 @@ function bp_has_activities( $args = '' ) {
453
'in' => $in,
454
'filter' => $filter,
455
'search_terms' => $search_terms,
456
'display_comments' => $display_comments,
457
'show_hidden' => $show_hidden,
458
'spam' => $spam
@@ -1073,14 +1083,14 @@ function bp_activity_secondary_avatar( $args = '' ) {
1073
case 'groups' :
1074
$object = 'group';
1075
$item_id = $activities_template->activity->item_id;
1076
1077
// Only if groups is active
1078
if ( bp_is_active( 'groups' ) ) {
1079
$group = groups_get_group( array( 'group_id' => $item_id ) );
1080
$link = bp_get_group_permalink( $group );
1081
$name = $group->name;
1082
- } else {
1083
- $name = '';
1084
}
1085
1086
if ( empty( $alt ) ) {
@@ -2019,6 +2029,34 @@ function bp_activity_thread_permalink() {
2019
return apply_filters( 'bp_get_activity_thread_permalink', $link );
2020
}
2021
2022
/**
2023
* Echoes the activity favorite link
2024
*
@@ -2395,6 +2433,10 @@ function bp_total_favorite_count_for_user( $user_id = 0 ) {
2395
* @return int The total favorite count for a specified user
2396
*/
2397
function bp_get_total_favorite_count_for_user( $user_id = 0 ) {
2398
return apply_filters( 'bp_get_total_favorite_count_for_user', bp_activity_total_favorites_for_user( $user_id ) );
2399
}
2400
@@ -2408,7 +2450,7 @@ function bp_total_favorite_count_for_user( $user_id = 0 ) {
2408
* @uses bp_get_total_favorite_count_for_user()
2409
*/
2410
function bp_total_mention_count_for_user( $user_id = 0 ) {
2411
- echo bp_get_total_favorite_count_for_user( $user_id );
2412
}
2413
2414
/**
@@ -2422,6 +2464,10 @@ function bp_total_mention_count_for_user( $user_id = 0 ) {
2422
* @return int The total mention count for a specified user
2423
*/
2424
function bp_get_total_mention_count_for_user( $user_id = 0 ) {
2425
return apply_filters( 'bp_get_total_mention_count_for_user', bp_get_user_meta( $user_id, 'bp_new_mention_count', true ) );
2426
}
2427
@@ -2458,7 +2504,7 @@ function bp_send_public_message_link() {
2458
if ( bp_is_my_profile() || !is_user_logged_in() )
2459
return false;
2460
2461
- 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_get_displayed_user_username(), $bp->displayed_user->userdata->user_login ) ) );
2462
}
2463
2464
/**
@@ -2757,7 +2803,7 @@ function bp_activities_member_rss_link() { echo bp_get_member_activity_feed_link
2757
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/';
2758
elseif ( 'favorites' == bp_current_action() )
2759
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
2760
- elseif ( 'mentions' == bp_current_action() )
2761
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
2762
else
2763
$link = '';
150
'in' => false,
151
'filter' => false,
152
'search_terms' => false,
153
+ 'meta_query' => false,
154
'display_comments' => 'threaded',
155
'show_hidden' => false,
156
'spam' => 'ham_only',
173
174
// Fetch all activity items
175
else
176
+ $this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'meta_query' => $meta_query, 'filter' => $filter, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in, 'spam' => $spam ) );
177
178
if ( !$max || $max >= (int) $this->activities['total'] )
179
$this->total_activity_count = (int) $this->activities['total'];
362
'primary_id' => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
363
'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
364
365
+ 'meta_query' => false, // filter on activity meta. See WP_Meta_Query for format
366
+
367
// Searching
368
'search_terms' => false // specify terms to search on
369
);
413
if ( empty( $favs ) )
414
return false;
415
416
+ $in = implode( ',', (array) $favs );
417
$display_comments = true;
418
+ $user_id = 0;
419
break;
420
case 'mentions':
421
422
+ // Are mentions disabled?
423
+ if ( ! bp_activity_do_mentions() ) {
424
+ return false;
425
+ }
426
+
427
// Start search at @ symbol and stop search at closing tag delimiter.
428
$search_terms = '@' . bp_core_get_username( $user_id ) . '<';
429
$display_comments = 'stream';
462
'in' => $in,
463
'filter' => $filter,
464
'search_terms' => $search_terms,
465
+ 'meta_query' => $meta_query,
466
'display_comments' => $display_comments,
467
'show_hidden' => $show_hidden,
468
'spam' => $spam
1083
case 'groups' :
1084
$object = 'group';
1085
$item_id = $activities_template->activity->item_id;
1086
+ $link = '';
1087
+ $name = '';
1088
1089
// Only if groups is active
1090
if ( bp_is_active( 'groups' ) ) {
1091
$group = groups_get_group( array( 'group_id' => $item_id ) );
1092
$link = bp_get_group_permalink( $group );
1093
$name = $group->name;
1094
}
1095
1096
if ( empty( $alt ) ) {
2029
return apply_filters( 'bp_get_activity_thread_permalink', $link );
2030
}
2031
2032
+ /**
2033
+ * Echoes the activity comment permalink
2034
+ *
2035
+ * @since BuddyPress (1.8)
2036
+ *
2037
+ * @uses bp_get_activity_permalink_id()
2038
+ */
2039
+ function bp_activity_comment_permalink() {
2040
+ echo bp_get_activity_comment_permalink();
2041
+ }
2042
+ /**
2043
+ * Gets the activity comment permalink
2044
+ *
2045
+ * @since BuddyPress (1.8)
2046
+ *
2047
+ * @uses bp_activity_get_permalink()
2048
+ * @uses apply_filters() To call the 'bp_get_activity_comment_permalink' hook
2049
+ *
2050
+ * @return string $link The activity comment permalink
2051
+ */
2052
+ function bp_get_activity_comment_permalink() {
2053
+ global $activities_template;
2054
+
2055
+ $link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ) . '#acomment-' . $activities_template->activity->current_comment->id;
2056
+
2057
+ return apply_filters( 'bp_get_activity_comment_permalink', $link );
2058
+ }
2059
+
2060
/**
2061
* Echoes the activity favorite link
2062
*
2433
* @return int The total favorite count for a specified user
2434
*/
2435
function bp_get_total_favorite_count_for_user( $user_id = 0 ) {
2436
+ if ( ! $user_id ) {
2437
+ $user_id = bp_displayed_user_id();
2438
+ }
2439
+
2440
return apply_filters( 'bp_get_total_favorite_count_for_user', bp_activity_total_favorites_for_user( $user_id ) );
2441
}
2442
2450
* @uses bp_get_total_favorite_count_for_user()
2451
*/
2452
function bp_total_mention_count_for_user( $user_id = 0 ) {
2453
+ echo bp_get_total_mention_count_for_user( $user_id );
2454
}
2455
2456
/**
2464
* @return int The total mention count for a specified user
2465
*/
2466
function bp_get_total_mention_count_for_user( $user_id = 0 ) {
2467
+ if ( ! $user_id ) {
2468
+ $user_id = bp_displayed_user_id();
2469
+ }
2470
+
2471
return apply_filters( 'bp_get_total_mention_count_for_user', bp_get_user_meta( $user_id, 'bp_new_mention_count', true ) );
2472
}
2473
2504
if ( bp_is_my_profile() || !is_user_logged_in() )
2505
return false;
2506
2507
+ return apply_filters( 'bp_get_send_public_message_link', wp_nonce_url( bp_get_activity_directory_permalink() . '?r=' . bp_core_get_username( bp_displayed_user_id(), bp_get_displayed_user_username(), $bp->displayed_user->userdata->user_login ) ) );
2508
}
2509
2510
/**
2803
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/';
2804
elseif ( 'favorites' == bp_current_action() )
2805
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
2806
+ elseif ( 'mentions' == bp_current_action() && bp_activity_do_mentions() )
2807
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
2808
else
2809
$link = '';
bp-activity/feeds/bp-activity-favorites-feed.php DELETED
@@ -1,74 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * RSS2 Feed Template for displaying a member's favorite activity
5
- *
6
- * @package BuddyPress
7
- * @subpackage ActivityFeeds
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( !defined( 'ABSPATH' ) ) exit;
12
-
13
- header('Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
14
- header('Status: 200 OK');
15
- echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?'.'>'; ?>
16
-
17
- <rss version="2.0"
18
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
19
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
20
- xmlns:dc="http://purl.org/dc/elements/1.1/"
21
- xmlns:atom="http://www.w3.org/2005/Atom"
22
- <?php do_action('bp_activity_favorites_feed'); ?>
23
- >
24
-
25
- <channel>
26
- <?php /* translators: Favorited activity RSS title - "[Site Name] | [Displayed User Name] | Favorite Activity" */ ?>
27
- <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'Favorite Activity', 'buddypress' ) ) ?></title>
28
- <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
29
- <link><?php echo home_url( bp_get_activity_root_slug() . '/#my-favorites/' ) ?></link>
30
- <description><?php printf( __( '%s - Favorite Activity', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
31
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
32
- <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
33
- <language><?php bloginfo_rss( 'language' ); ?></language>
34
-
35
- <?php do_action('bp_activity_favorites_feed_head'); ?>
36
-
37
- <?php
38
- $favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
39
- $fav_ids = implode( ',', (array) $favs );
40
- ?>
41
-
42
- <?php if ( bp_has_activities( 'include=' . $fav_ids . '&max=50&display_comments=stream' ) ) : ?>
43
- <?php while ( bp_activities() ) : bp_the_activity(); ?>
44
-
45
- <item>
46
- <guid><?php bp_activity_thread_permalink() ?></guid>
47
- <title><?php bp_activity_feed_item_title() ?></title>
48
- <link><?php echo bp_activity_thread_permalink() ?></link>
49
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
50
-
51
- <description>
52
- <![CDATA[
53
- <?php bp_activity_feed_item_description() ?>
54
-
55
- <?php if ( bp_activity_can_comment() ) : ?>
56
- <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
57
- <?php endif; ?>
58
-
59
- <?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
60
- <br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
61
- <?php bp_activity_parent_content() ?>
62
- <?php endif; ?>
63
- ]]>
64
- </description>
65
-
66
- <?php do_action('bp_activity_favorites_feed_item'); ?>
67
-
68
- </item>
69
-
70
- <?php endwhile; ?>
71
- <?php endif; ?>
72
-
73
- </channel>
74
- </rss>
bp-activity/feeds/bp-activity-friends-feed.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * RSS2 Feed Template for displaying a member's friends activity stream.
5
- *
6
- * @package BuddyPress
7
- * @subpackage ActivityFeeds
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( !defined( 'ABSPATH' ) ) exit;
12
-
13
- header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
14
- header('Status: 200 OK');
15
- echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
16
-
17
- <rss version="2.0"
18
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
19
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
20
- xmlns:dc="http://purl.org/dc/elements/1.1/"
21
- xmlns:atom="http://www.w3.org/2005/Atom"
22
- <?php do_action('bp_activity_friends_feed'); ?>
23
- >
24
-
25
- <channel>
26
- <?php /* translators: Member friends activity RSS title - "[Site Name] | Friends Activity" */ ?>
27
- <title><?php bp_site_name() ?> | <?php bp_displayed_user_fullname(); ?> | <?php _e( 'Friends Activity', 'buddypress' ); ?></title>
28
- <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
29
- <link><?php echo bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed'; ?></link>
30
- <description><?php printf( __( '%s - Friends Activity Feed', 'buddypress' ), bp_get_displayed_user_fullname() ); ?></description>
31
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
32
- <generator>http://buddypress.org/?v=<?php echo BP_VERSION; ?></generator>
33
- <language><?php bloginfo_rss( 'language' ); ?></language>
34
- <?php do_action('bp_activity_friends_feed_head'); ?>
35
-
36
- <?php if ( bp_has_activities( 'scope=friends&max=50&display_comments=stream' ) ) : ?>
37
- <?php while ( bp_activities() ) : bp_the_activity(); ?>
38
- <item>
39
- <guid><?php bp_activity_thread_permalink(); ?></guid>
40
- <title><?php bp_activity_feed_item_title(); ?></title>
41
- <link><?php echo bp_activity_thread_permalink(); ?></link>
42
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
43
-
44
- <description>
45
- <![CDATA[
46
- <?php bp_activity_feed_item_description(); ?>
47
-
48
- <?php if ( bp_activity_can_comment() ) : ?>
49
- <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
50
- <?php endif; ?>
51
-
52
- <?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
53
- <br /><strong><?php _e( 'In reply to', 'buddypress' ); ?></strong> -
54
- <?php bp_activity_parent_content(); ?>
55
- <?php endif; ?>
56
- ]]>
57
- </description>
58
- <?php do_action('bp_activity_personal_feed_item'); ?>
59
- </item>
60
- <?php endwhile; ?>
61
-
62
- <?php endif; ?>
63
- </channel>
64
- </rss>
bp-activity/feeds/bp-activity-group-feed.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * RSS2 Feed Template for displaying a group activity stream
5
- *
6
- * @package BuddyPress
7
- * @subpackage ActivityFeeds
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( !defined( 'ABSPATH' ) ) exit;
12
-
13
- header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
14
- header('Status: 200 OK');
15
- echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
16
-
17
- <rss version="2.0"
18
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
19
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
20
- xmlns:dc="http://purl.org/dc/elements/1.1/"
21
- xmlns:atom="http://www.w3.org/2005/Atom"
22
- <?php do_action('bp_activity_group_feed'); ?>
23
- >
24
-
25
- <channel>
26
- <?php /* translators: Single group activity RSS title - "[Site Name] | [Group Name] | Group Activity" */ ?>
27
- <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_current_group_name(), __( 'Group Activity', 'buddypress' ) ) ?></title>
28
- <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
29
- <link><?php echo bp_get_group_permalink( $bp->groups->current_group ) . bp_get_activity_slug() . '/feed' ?></link>
30
- <description><?php printf( __( '%s - Group Activity Feed', 'buddypress' ), $bp->groups->current_group->name ) ?></description>
31
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
32
- <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
33
- <language><?php bloginfo_rss( 'language' ); ?></language>
34
- <?php do_action('bp_activity_group_feed_head'); ?>
35
-
36
- <?php if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id . '&max=50&display_comments=threaded' ) ) : ?>
37
- <?php while ( bp_activities() ) : bp_the_activity(); ?>
38
- <item>
39
- <guid><?php bp_activity_thread_permalink() ?></guid>
40
- <title><?php bp_activity_feed_item_title() ?></title>
41
- <link><?php echo bp_activity_thread_permalink() ?></link>
42
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
43
-
44
- <description>
45
- <![CDATA[
46
- <?php bp_activity_feed_item_description() ?>
47
-
48
- <?php if ( bp_activity_can_comment() ) : ?>
49
- <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
50
- <?php endif; ?>
51
- ]]>
52
- </description>
53
- <?php do_action('bp_activity_group_feed_item'); ?>
54
- </item>
55
- <?php endwhile; ?>
56
-
57
- <?php endif; ?>
58
- </channel>
59
- </rss>
bp-activity/feeds/bp-activity-mentions-feed.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * RSS2 Feed Template for displaying a member's activity mentions
5
- *
6
- * @package BuddyPress
7
- * @subpackage ActivityFeeds
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( !defined( 'ABSPATH' ) ) exit;
12
-
13
- header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
14
- header('Status: 200 OK');
15
- echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
16
-
17
- <rss version="2.0"
18
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
19
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
20
- xmlns:dc="http://purl.org/dc/elements/1.1/"
21
- xmlns:atom="http://www.w3.org/2005/Atom"
22
- <?php do_action('bp_activity_mentions_feed'); ?>
23
- >
24
-
25
- <channel>
26
- <?php /* translators: Mentions RSS title - "[Site Name] | [Displayed User Name] | Mentions" */ ?>
27
- <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'Mentions', 'buddypress' ) ) ?></title>
28
- <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
29
- <link><?php echo home_url( bp_get_activity_root_slug() . '/#mentions/' ) ?></link>
30
- <?php /* translators: Mentions RSS title - "[Site Name] | [Displayed User Name] | Mentions" */ ?>
31
- <description><?php printf( __( '%s - Mentions', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
32
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
33
- <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
34
- <language><?php bloginfo_rss( 'language' ); ?></language>
35
- <?php do_action('bp_activity_mentions_feed_head'); ?>
36
-
37
- <?php if ( bp_has_activities( 'max=50&display_comments=stream&search_terms=@' . bp_core_get_username( bp_displayed_user_id() ) ) ) : ?>
38
- <?php while ( bp_activities() ) : bp_the_activity(); ?>
39
- <item>
40
- <guid><?php bp_activity_thread_permalink() ?></guid>
41
- <title><?php bp_activity_feed_item_title() ?></title>
42
- <link><?php echo bp_activity_thread_permalink() ?></link>
43
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
44
-
45
- <description>
46
- <![CDATA[
47
- <?php bp_activity_feed_item_description() ?>
48
-
49
- <?php if ( bp_activity_can_comment() ) : ?>
50
- <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
51
- <?php endif; ?>
52
-
53
- <?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
54
- <br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
55
- <?php bp_activity_parent_content() ?>
56
- <?php endif; ?>
57
- ]]>
58
- </description>
59
- <?php do_action('bp_activity_mentions_feed_item'); ?>
60
- </item>
61
- <?php endwhile; ?>
62
-
63
- <?php endif; ?>
64
- </channel>
65
- </rss>
bp-activity/feeds/bp-activity-mygroups-feed.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * RSS2 Feed Template for displaying a member's group's activity
5
- *
6
- * @package BuddyPress
7
- * @subpackage ActivityFeeds
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( !defined( 'ABSPATH' ) ) exit;
12
-
13
- header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
14
- header('Status: 200 OK');
15
- echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
16
-
17
- <rss version="2.0"
18
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
19
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
20
- xmlns:dc="http://purl.org/dc/elements/1.1/"
21
- xmlns:atom="http://www.w3.org/2005/Atom"
22
- <?php do_action('bp_activity_mygroups_feed'); ?>
23
- >
24
-
25
- <channel>
26
- <?php /* translators: Member groups activity RSS title - "[Site Name] | [Displayed User Name] | My Groups - Public Activity" */ ?>
27
- <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'My Groups - Public Activity', 'buddypress' ) ) ?></title>
28
- <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
29
- <link><?php echo home_url( bp_get_activity_root_slug() . '/#my-groups/' ) ?></link>
30
- <?php /* translators: Member groups activity RSS description - "[Displayed user name] - My Groups - Public Activity" */ ?>
31
- <description><?php printf( __( '%1$s - My Groups - Public Activity', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
32
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
33
- <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
34
- <language><?php bloginfo_rss( 'language' ); ?></language>
35
- <?php do_action('bp_activity_mygroups_feed_head'); ?>
36
-
37
- <?php
38
- $groups = groups_get_user_groups( bp_loggedin_user_id() );
39
- $group_ids = implode( ',', $groups['groups'] );
40
- ?>
41
-
42
- <?php if ( bp_has_activities( 'object=' . $bp->groups->id . '&primary_id=' . $group_ids . '&max=50&display_comments=threaded' ) ) : ?>
43
- <?php while ( bp_activities() ) : bp_the_activity(); ?>
44
- <item>
45
- <guid><?php bp_activity_thread_permalink() ?></guid>
46
- <title><?php bp_activity_feed_item_title() ?></title>
47
- <link><?php echo bp_activity_thread_permalink() ?></link>
48
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
49
-
50
- <description>
51
- <![CDATA[
52
- <?php bp_activity_feed_item_description() ?>
53
-
54
- <?php if ( bp_activity_can_comment() ) : ?>
55
- <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
56
- <?php endif; ?>
57
- ]]>
58
- </description>
59
- <?php do_action('bp_activity_mygroups_feed_item'); ?>
60
- </item>
61
- <?php endwhile; ?>
62
-
63
- <?php endif; ?>
64
- </channel>
65
- </rss>
bp-activity/feeds/bp-activity-personal-feed.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * RSS2 Feed Template for displaying a member's activity stream.
5
- *
6
- * @package BuddyPress
7
- * @subpackage ActivityFeeds
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( !defined( 'ABSPATH' ) ) exit;
12
-
13
- header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
14
- header('Status: 200 OK');
15
- echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
16
-
17
- <rss version="2.0"
18
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
19
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
20
- xmlns:dc="http://purl.org/dc/elements/1.1/"
21
- xmlns:atom="http://www.w3.org/2005/Atom"
22
- <?php do_action('bp_activity_personal_feed'); ?>
23
- >
24
-
25
- <channel>
26
- <?php /* translators: Personal activity RSS title - "[Site Name] | [Displayed User Name] | Activity" */ ?>
27
- <title><?php printf( '%1$s | %2$s | %3$s', bp_get_site_name(), bp_get_displayed_user_fullname(), __( 'Activity', 'buddypress' ) ) ?></title>
28
- <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
29
- <link><?php echo bp_displayed_user_domain() . bp_get_activity_slug() . '/feed' ?></link>
30
- <description><?php printf( __( '%s - Activity Feed', 'buddypress' ), bp_get_displayed_user_fullname() ) ?></description>
31
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
32
- <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
33
- <language><?php bloginfo_rss( 'language' ); ?></language>
34
- <?php do_action('bp_activity_personal_feed_head'); ?>
35
-
36
- <?php if ( bp_has_activities( 'user_id=' . bp_displayed_user_id() . '&max=50&display_comments=stream' ) ) : ?>
37
- <?php while ( bp_activities() ) : bp_the_activity(); ?>
38
- <item>
39
- <guid><?php bp_activity_thread_permalink() ?></guid>
40
- <title><?php bp_activity_feed_item_title() ?></title>
41
- <link><?php echo bp_activity_thread_permalink() ?></link>
42
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
43
-
44
- <description>
45
- <![CDATA[
46
- <?php bp_activity_feed_item_description() ?>
47
-
48
- <?php if ( bp_activity_can_comment() ) : ?>
49
- <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
50
- <?php endif; ?>
51
-
52
- <?php if ( 'activity_comment' == bp_get_activity_action_name() ) : ?>
53
- <br /><strong><?php _e( 'In reply to', 'buddypress' ) ?></strong> -
54
- <?php bp_activity_parent_content() ?>
55
- <?php endif; ?>
56
- ]]>
57
- </description>
58
- <?php do_action('bp_activity_personal_feed_item'); ?>
59
- </item>
60
- <?php endwhile; ?>
61
-
62
- <?php endif; ?>
63
- </channel>
64
- </rss>
bp-activity/feeds/bp-activity-sitewide-feed.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * RSS2 Feed Template for displaying the site wide activity stream.
5
- *
6
- * @package BuddyPress
7
- * @subpackage ActivityFeeds
8
- */
9
-
10
- // Exit if accessed directly
11
- if ( !defined( 'ABSPATH' ) ) exit;
12
-
13
- header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
14
- header('Status: 200 OK');
15
- echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
16
-
17
- <rss version="2.0"
18
- xmlns:content="http://purl.org/rss/1.0/modules/content/"
19
- xmlns:wfw="http://wellformedweb.org/CommentAPI/"
20
- xmlns:dc="http://purl.org/dc/elements/1.1/"
21
- xmlns:atom="http://www.w3.org/2005/Atom"
22
- <?php do_action('bp_activity_sitewide_feed'); ?>
23
- >
24
-
25
- <channel>
26
- <?php /* translators: Sitewide activity RSS title - "[Site Name] | Site Wide Activity" */ ?>
27
- <title><?php printf( '%1$s | %2$s', bp_get_site_name(), __( 'Site Wide Activity', 'buddypress' ) ) ?></title>
28
- <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
29
- <link><?php echo bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/feed' ?></link>
30
- <description><?php _e( 'Site Wide Activity Feed', 'buddypress' ) ?></description>
31
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false); ?></pubDate>
32
- <generator>http://buddypress.org/?v=<?php echo BP_VERSION ?></generator>
33
- <language><?php bloginfo_rss( 'language' ); ?></language>
34
- <?php do_action('bp_activity_sitewide_feed_head'); ?>
35
-
36
- <?php if ( bp_has_activities( 'type=sitewide&max=50&display_comments=threaded' ) ) : ?>
37
- <?php while ( bp_activities() ) : bp_the_activity(); ?>
38
- <item>
39
- <guid><?php bp_activity_thread_permalink() ?></guid>
40
- <title><?php bp_activity_feed_item_title() ?></title>
41
- <link><?php bp_activity_thread_permalink() ?></link>
42
- <pubDate><?php echo mysql2date('D, d M Y H:i:s O', bp_get_activity_feed_item_date(), false); ?></pubDate>
43
-
44
- <description>
45
- <![CDATA[
46
- <?php bp_activity_feed_item_description() ?>
47
-
48
- <?php if ( bp_activity_can_comment() ) : ?>
49
- <p><?php printf( __( 'Comments: %s', 'buddypress' ), bp_activity_get_comment_count() ); ?></p>
50
- <?php endif; ?>
51
- ]]>
52
- </description>
53
- <?php do_action('bp_activity_personal_feed_item'); ?>
54
- </item>
55
- <?php endwhile; ?>
56
-
57
- <?php endif; ?>
58
- </channel>
59
- </rss>
bp-blogs/bp-blogs-actions.php CHANGED
@@ -26,7 +26,7 @@ function bp_blogs_redirect_to_random_blog() {
26
// Multisite is active so find a random blog
27
if ( is_multisite() ) {
28
$blog = bp_blogs_get_random_blogs( 1, 1 );
29
- bp_core_redirect( get_site_url( $blog['blogs'][0]->blog_id ) );
30
31
// No multisite and still called, always redirect to root
32
} else {
26
// Multisite is active so find a random blog
27
if ( is_multisite() ) {
28
$blog = bp_blogs_get_random_blogs( 1, 1 );
29
+ bp_core_redirect( get_home_url( $blog['blogs'][0]->blog_id ) );
30
31
// No multisite and still called, always redirect to root
32
} else {
bp-blogs/bp-blogs-functions.php CHANGED
@@ -49,21 +49,21 @@ function bp_blogs_record_existing_blogs() {
49
$wpdb->query( "TRUNCATE TABLE {$bp->blogs->table_name}" );
50
51
if ( is_multisite() ) {
52
- $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0 AND site_id = %d" ), $wpdb->siteid );
53
} else {
54
$blog_ids = 1;
55
}
56
57
if ( !empty( $blog_ids ) ) {
58
foreach( (array) $blog_ids as $blog_id ) {
59
- $users = get_users( array( 'blog_id' => $blog_id ) );
60
- $subscribers = get_users( array( 'blog_id' => $blog_id, 'role' => 'subscriber' ) );
61
62
if ( !empty( $users ) ) {
63
foreach ( (array) $users as $user ) {
64
// Don't record blogs for subscribers
65
if ( !in_array( $user, $subscribers ) ) {
66
- bp_blogs_record_blog( $blog_id, $user->ID, true );
67
}
68
}
69
}
@@ -76,7 +76,7 @@ function bp_blogs_record_existing_blogs() {
76
*
77
* If $user_id is provided, you can restrict site from being recordable
78
* only to particular users.
79
- *
80
* @since BuddyPress (1.7)
81
* @param int $blog_id
82
* @param int|null $user_id
@@ -104,7 +104,7 @@ function bp_blogs_is_blog_recordable( $blog_id, $user_id = 0 ) {
104
* Makes BuddyPress aware of sites that activities shouldn't be trackable.
105
* If $user_id is provided, the developer can restrict site from
106
* being trackable only to particular users.
107
- *
108
* @since BuddyPress (1.7)
109
* @param int $blog_id
110
* @param int|null $user_id
@@ -172,8 +172,8 @@ function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
172
// Record this in activity streams
173
bp_blogs_record_activity( array(
174
'user_id' => $recorded_blog->user_id,
175
- 'action' => apply_filters( 'bp_blogs_activity_created_blog_action', sprintf( __( '%s created the site %s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_site_url( $recorded_blog->blog_id ) . '">' . esc_attr( $name ) . '</a>' ), $recorded_blog, $name, $description ),
176
- 'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', get_site_url( $recorded_blog->blog_id ), $recorded_blog->blog_id ),
177
'type' => 'new_blog',
178
'item_id' => $recorded_blog->blog_id
179
) );
@@ -257,7 +257,6 @@ function bp_blogs_record_post( $post_id, $post, $user_id = 0 ) {
257
if ( bp_is_active( 'activity' ) ) {
258
$existing = bp_activity_get( array(
259
'filter' => array(
260
- 'user_id' => (int) $post->post_author,
261
'action' => 'new_blog_post',
262
'primary_id' => $blog_id,
263
'secondary_id' => $post_id,
49
$wpdb->query( "TRUNCATE TABLE {$bp->blogs->table_name}" );
50
51
if ( is_multisite() ) {
52
+ $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0 AND site_id = %d", $wpdb->siteid ) );
53
} else {
54
$blog_ids = 1;
55
}
56
57
if ( !empty( $blog_ids ) ) {
58
foreach( (array) $blog_ids as $blog_id ) {
59
+ $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ID' ) );
60
+ $subscribers = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ID', 'role' => 'subscriber' ) );
61
62
if ( !empty( $users ) ) {
63
foreach ( (array) $users as $user ) {
64
// Don't record blogs for subscribers
65
if ( !in_array( $user, $subscribers ) ) {
66
+ bp_blogs_record_blog( $blog_id, $user, true );
67
}
68
}
69
}
76
*
77
* If $user_id is provided, you can restrict site from being recordable
78
* only to particular users.
79
+ *
80
* @since BuddyPress (1.7)
81
* @param int $blog_id
82
* @param int|null $user_id
104
* Makes BuddyPress aware of sites that activities shouldn't be trackable.
105
* If $user_id is provided, the developer can restrict site from
106
* being trackable only to particular users.
107
+ *
108
* @since BuddyPress (1.7)
109
* @param int $blog_id
110
* @param int|null $user_id
172
// Record this in activity streams
173
bp_blogs_record_activity( array(
174
'user_id' => $recorded_blog->user_id,
175
+ 'action' => apply_filters( 'bp_blogs_activity_created_blog_action', sprintf( __( '%s created the site %s', 'buddypress'), bp_core_get_userlink( $recorded_blog->user_id ), '<a href="' . get_home_url( $recorded_blog->blog_id ) . '">' . esc_attr( $name ) . '</a>' ), $recorded_blog, $name, $description ),
176
+ 'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', get_home_url( $recorded_blog->blog_id ), $recorded_blog->blog_id ),
177
'type' => 'new_blog',
178
'item_id' => $recorded_blog->blog_id
179
) );
257
if ( bp_is_active( 'activity' ) ) {
258
$existing = bp_activity_get( array(
259
'filter' => array(
260
'action' => 'new_blog_post',
261
'primary_id' => $blog_id,
262
'secondary_id' => $post_id,
bp-blogs/bp-blogs-loader.php CHANGED
@@ -180,6 +180,15 @@ class BP_Blogs_Component extends BP_Component {
180
'href' => trailingslashit( $blogs_link )
181
);
182
183
}
184
185
parent::setup_admin_bar( $wp_admin_nav );
180
'href' => trailingslashit( $blogs_link )
181
);
182
183
+ // Create a Blog
184
+ if ( bp_blog_signup_enabled() ) {
185
+ $wp_admin_nav[] = array(
186
+ 'parent' => 'my-account-' . $this->id,
187
+ 'id' => 'my-account-' . $this->id . '-create',
188
+ 'title' => __( 'Create a Blog', 'buddypress' ),
189
+ 'href' => trailingslashit( bp_get_blogs_directory_permalink() . 'create' )
190
+ );
191
+ }
192
}
193
194
parent::setup_admin_bar( $wp_admin_nav );
bp-blogs/bp-blogs-screens.php CHANGED
@@ -86,11 +86,13 @@ class BP_Blogs_Theme_Compat {
86
87
do_action( 'bp_blogs_screen_index' );
88
89
add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) );
90
add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) );
91
92
// Create blog
93