BuddyPress - Version 1.6-RC2

Version Description

= 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 DJPaul
Plugin Icon 128x128 BuddyPress
Version 1.6-RC2
Comparing to
See all releases

Code changes from version 1.5.7 to 1.6-RC2

Files changed (116) hide show
  1. bp-activity/admin/css/admin.css +1 -0
  2. bp-activity/admin/css/admin.dev.css +77 -0
  3. bp-activity/admin/js/admin.dev.js +167 -0
  4. bp-activity/admin/js/admin.js +1 -0
  5. bp-activity/bp-activity-actions.php +109 -38
  6. bp-activity/bp-activity-admin.php +1393 -0
  7. bp-activity/bp-activity-akismet.php +587 -0
  8. bp-activity/bp-activity-cache.php +39 -0
  9. bp-activity/bp-activity-classes.php +157 -45
  10. bp-activity/bp-activity-filters.php +89 -17
  11. bp-activity/bp-activity-functions.php +388 -155
  12. bp-activity/bp-activity-loader.php +51 -28
  13. bp-activity/bp-activity-notifications.php +15 -6
  14. bp-activity/bp-activity-screens.php +28 -30
  15. bp-activity/bp-activity-template.php +335 -288
  16. bp-activity/feeds/bp-activity-favorites-feed.php +5 -4
  17. bp-activity/feeds/bp-activity-friends-feed.php +1 -0
  18. bp-activity/feeds/bp-activity-group-feed.php +2 -1
  19. bp-activity/feeds/bp-activity-mentions-feed.php +6 -4
  20. bp-activity/feeds/bp-activity-mygroups-feed.php +5 -3
  21. bp-activity/feeds/bp-activity-personal-feed.php +4 -3
  22. bp-activity/feeds/bp-activity-sitewide-feed.php +2 -1
  23. bp-blogs/bp-blogs-actions.php +26 -4
  24. bp-blogs/bp-blogs-activity.php +64 -29
  25. bp-blogs/bp-blogs-buddybar.php +26 -8
  26. bp-blogs/bp-blogs-cache.php +25 -4
  27. bp-blogs/bp-blogs-classes.php +34 -26
  28. bp-blogs/bp-blogs-filters.php +26 -0
  29. bp-blogs/bp-blogs-functions.php +156 -55
  30. bp-blogs/bp-blogs-loader.php +36 -17
  31. bp-blogs/bp-blogs-screens.php +9 -1
  32. bp-blogs/bp-blogs-template.php +48 -48
  33. bp-blogs/bp-blogs-widgets.php +11 -12
  34. bp-core/admin/bp-core-admin.php +0 -637
  35. bp-core/admin/bp-core-components.php +300 -0
  36. bp-core/admin/bp-core-functions.php +399 -0
  37. bp-core/admin/bp-core-schema.php +116 -32
  38. bp-core/admin/bp-core-settings.php +368 -0
  39. bp-core/admin/bp-core-slugs.php +224 -0
  40. bp-core/admin/bp-core-update.php +287 -590
  41. bp-core/admin/css/common.css +1 -0
  42. bp-core/admin/css/common.dev.css +143 -0
  43. bp-core/admin/css/wizard.css +1 -0
  44. bp-core/{css/admin.dev.css → admin/css/wizard.dev.css} +56 -41
  45. bp-core/{images → admin/images}/completed.gif +0 -0
  46. bp-core/{images → admin/images}/find.png +0 -0
  47. bp-core/admin/images/icons32.png +0 -0
  48. bp-core/{images → admin/images}/installed.gif +0 -0
  49. bp-core/admin/images/menu-wp.png +0 -0
  50. bp-core/admin/images/menu.png +0 -0
  51. bp-core/{js/update.dev.js → admin/js/wizard.dev.js} +0 -0
  52. bp-core/{js/update.js → admin/js/wizard.js} +0 -0
  53. bp-core/bp-core-actions.php +267 -0
  54. bp-core/bp-core-admin.php +511 -0
  55. bp-core/bp-core-adminbar.php +35 -225
  56. bp-core/bp-core-avatars.php +230 -121
  57. bp-core/bp-core-buddybar.php +169 -104
  58. bp-core/bp-core-cache.php +88 -3
  59. bp-core/bp-core-caps.php +426 -0
  60. bp-core/bp-core-catchuri.php +326 -90
  61. bp-core/bp-core-classes.php +172 -138
  62. bp-core/bp-core-component.php +57 -26
  63. bp-core/bp-core-cssjs.php +3 -36
  64. bp-core/bp-core-filters.php +72 -51
  65. bp-core/bp-core-functions.php +288 -555
  66. bp-core/bp-core-hooks.php +0 -114
  67. bp-core/bp-core-loader.php +81 -68
  68. bp-core/bp-core-moderation.php +268 -0
  69. bp-core/bp-core-options.php +524 -0
  70. bp-core/bp-core-template.php +110 -72
  71. bp-core/bp-core-update.php +197 -0
  72. bp-core/bp-core-widgets.php +23 -29
  73. bp-core/bp-core-wpabstraction.php +5 -6
  74. bp-core/css/admin-bar-rtl.css +1 -1
  75. bp-core/css/admin-bar.css +1 -1
  76. bp-core/css/admin-bar.dev.css +25 -29
  77. bp-core/css/admin.css +0 -1
  78. bp-core/css/buddybar-rtl.css +1 -1
  79. bp-core/css/buddybar.css +1 -1
  80. bp-core/css/buddybar.dev.css +2 -4
  81. bp-core/deprecated/1.5.php +134 -5
  82. bp-core/deprecated/1.6.php +264 -0
  83. bp-core/images/admin-bar-sprite-rtl.png +0 -0
  84. bp-core/images/admin-bar-sprite.png +0 -0
  85. bp-core/images/admin_menu_icon.png +0 -0
  86. bp-core/images/icons32.png +0 -0
  87. bp-core/images/logo-column-header.png +0 -0
  88. bp-core/images/logo.png +0 -0
  89. bp-forums/bp-forums-admin.php +84 -26
  90. bp-forums/bp-forums-bbpress-sa.php +5 -9
  91. bp-forums/bp-forums-filters.php +3 -3
  92. bp-forums/bp-forums-functions.php +102 -29
  93. bp-forums/bp-forums-loader.php +25 -23
  94. bp-forums/bp-forums-screens.php +2 -2
  95. bp-forums/bp-forums-template.php +63 -59
  96. bp-forums/deprecated/1.6.php +203 -0
  97. bp-friends/bp-friends-actions.php +7 -1
  98. bp-friends/bp-friends-activity.php +26 -16
  99. bp-friends/bp-friends-cache.php +9 -4
  100. bp-friends/bp-friends-classes.php +53 -50
  101. bp-friends/bp-friends-functions.php +40 -23
  102. bp-friends/bp-friends-loader.php +25 -18
  103. bp-friends/bp-friends-notifications.php +20 -16
  104. bp-friends/bp-friends-screens.php +24 -9
  105. bp-friends/bp-friends-template.php +80 -95
  106. bp-groups/bp-groups-actions.php +41 -34
  107. bp-groups/bp-groups-activity.php +48 -39
  108. bp-groups/bp-groups-adminbar.php +27 -57
  109. bp-groups/bp-groups-buddybar.php +19 -4
  110. bp-groups/bp-groups-cache.php +58 -3
  111. bp-groups/bp-groups-classes.php +259 -154
  112. bp-groups/bp-groups-filters.php +27 -14
  113. bp-groups/bp-groups-forums.php +159 -42
  114. bp-groups/bp-groups-functions.php +125 -84
  115. bp-groups/bp-groups-loader.php +174 -55
  116. bp-groups/bp-groups-notifications.php +16 -9
bp-activity/admin/css/admin.css ADDED
@@ -0,0 +1 @@
 
1
+ .akismet-status{float:right}.akismet-status a{color:#AAA;font-style:italic}.akismet-history{margin:13px}.akismet-history div{margin-bottom:13px}.akismet-history span{color:#999}#wp-bp-activities-wrap{padding:5px 0}#bp-activities{height:120px}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top}#bp-activities-form .column-response img{float:left;margin-right:10px;margin-top:1px}.activity-errors{list-style-type:disc;margin-left:2em}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0}#bp_activity_action h3,#bp_activity_content h3{cursor:auto}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:white}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px}#bp_activity_link input{width:99%}#bp-activities-primaryid{margin-bottom:1em}
bp-activity/admin/css/admin.dev.css ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .akismet-status {
2
+ float: right;
3
+ }
4
+ .akismet-status a {
5
+ color: #AAA;
6
+ font-style: italic;
7
+ }
8
+ .akismet-history {
9
+ margin: 13px;
10
+ }
11
+ .akismet-history div {
12
+ margin-bottom: 13px;
13
+ }
14
+ .akismet-history span {
15
+ color: #999;
16
+ }
17
+
18
+ #wp-bp-activities-wrap {
19
+ padding: 5px 0;
20
+ }
21
+ #bp-activities {
22
+ height: 120px;
23
+ }
24
+ #bp-replyhead {
25
+ font-size: 1em;
26
+ line-height: 1.4em;
27
+ margin: 0;
28
+ }
29
+ #bp-replysubmit {
30
+ margin: 0;
31
+ padding: 0 0 3px;
32
+ text-align: center;
33
+ }
34
+ #bp-replysubmit .error {
35
+ color: red;
36
+ line-height: 21px;
37
+ text-align: center;
38
+ vertical-align: center;
39
+ }
40
+ #bp-replysubmit img.waiting {
41
+ float: right;
42
+ padding: 4px 10px 0;
43
+ vertical-align: top;
44
+ }
45
+ #bp-activities-form .column-response img {
46
+ float: left;
47
+ margin-right: 10px;
48
+ margin-top: 1px;
49
+ }
50
+ .activity-errors {
51
+ list-style-type: disc;
52
+ margin-left: 2em;
53
+ }
54
+
55
+ #bp_activity_action div.inside,
56
+ #bp_activity_content div.inside {
57
+ line-height: 0;
58
+ }
59
+ #bp_activity_action h3,
60
+ #bp_activity_content h3 {
61
+ cursor: auto;
62
+ }
63
+ #bp_activity_action td.mceIframeContainer,
64
+ #bp_activity_content td.mceIframeContainer {
65
+ background-color: white;
66
+ }
67
+ #post-body #bp-activities-action_resize,
68
+ #post-body #bp-activities-content_resize {
69
+ position: inherit;
70
+ margin-top: -2px;
71
+ }
72
+ #bp_activity_link input {
73
+ width: 99%;
74
+ }
75
+ #bp-activities-primaryid {
76
+ margin-bottom: 1em;
77
+ }
bp-activity/admin/js/admin.dev.js ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function( $ ) {
2
+
3
+ /**
4
+ * Activity reply object for the activity index screen
5
+ *
6
+ * @since 1.6
7
+ */
8
+ var activityReply = {
9
+
10
+ /**
11
+ * Attach event handler functions to the relevant elements.
12
+ *
13
+ * @since 1.6
14
+ */
15
+ init : function() {
16
+ $(document).on( 'click', '.row-actions a.reply', activityReply.open );
17
+ $(document).on( 'click', '#bp-activities-container a.cancel', activityReply.close );
18
+ $(document).on( 'click', '#bp-activities-container a.save', activityReply.send );
19
+
20
+ // Close textarea on escape
21
+ $(document).on( 'keyup', '#bp-activities:visible', function( e ) {
22
+ if ( 27 == e.which ) {
23
+ activityReply.close();
24
+ }
25
+ });
26
+ },
27
+
28
+ /**
29
+ * Reveals the entire row when "reply" is pressed.
30
+ *
31
+ * @since 1.6
32
+ */
33
+ open : function( e ) {
34
+ // Hide the container row, and move it to the new location
35
+ var box = $( '#bp-activities-container' ).hide();
36
+ $( this ).parents( 'tr' ).after( box );
37
+
38
+ // Fade the whole row in, and set focus on the text area.
39
+ box.fadeIn( '300' );
40
+ $( '#bp-activities' ).focus();
41
+
42
+ return false;
43
+ },
44
+
45
+ /**
46
+ * Hide and reset the entire row when "cancel", or escape, are pressed.
47
+ *
48
+ * @since 1.6
49
+ */
50
+ close : function( e ) {
51
+ // Hide the container row
52
+ $('#bp-activities-container').fadeOut( '200', function () {
53
+
54
+ // Empty and unfocus the text area
55
+ $( '#bp-activities' ).val( '' ).blur();
56
+
57
+ // Remove any error message and disable the spinner
58
+ $( '#bp-replysubmit .error' ).html( '' ).hide();
59
+ $( '#bp-replysubmit .waiting' ).hide();
60
+ });
61
+
62
+ return false;
63
+ },
64
+
65
+ /**
66
+ * Submits "form" via AJAX back to WordPress.
67
+ *
68
+ * @since 1.6
69
+ */
70
+ send : function( e ) {
71
+ // Hide any existing error message, and show the loading spinner
72
+ $( '#bp-replysubmit .error' ).hide();
73
+ $( '#bp-replysubmit .waiting' ).show();
74
+
75
+ // Grab the nonce
76
+ var reply = {};
77
+ reply['_ajax_nonce-bp-activity-admin-reply'] = $( '#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]' ).val();
78
+
79
+ // Get the rest of the data
80
+ reply.action = 'bp-activity-admin-reply';
81
+ reply.content = $( '#bp-activities' ).val();
82
+ reply.parent_id = $( '#bp-activities-container' ).prev().data( 'parent_id' );
83
+ reply.root_id = $( '#bp-activities-container' ).prev().data( 'root_id' );
84
+
85
+ // Make the AJAX call
86
+ $.ajax({
87
+ data : reply,
88
+ type : 'POST',
89
+ url : ajaxurl,
90
+
91
+ // Callbacks
92
+ error : function( r ) { activityReply.error( r ); },
93
+ success : function( r ) { activityReply.show( r ); }
94
+ });
95
+
96
+ return false;
97
+ },
98
+
99
+ /**
100
+ * send() error message handler
101
+ *
102
+ * @since 1.6
103
+ */
104
+ error : function( r ) {
105
+ var er = r.statusText;
106
+ $('#bp-replysubmit .waiting').hide();
107
+
108
+ if ( r.responseText ) {
109
+ er = r.responseText.replace( /<.[^<>]*?>/g, '' );
110
+ }
111
+
112
+ if ( er ) {
113
+ $('#bp-replysubmit .error').html( er ).show();
114
+ }
115
+ },
116
+
117
+ /**
118
+ * send() success handler
119
+ *
120
+ * @since 1.6
121
+ */
122
+ show : function ( xml ) {
123
+ var bg, id, response;
124
+
125
+ // Handle any errors in the response
126
+ if ( typeof( xml ) == 'string' ) {
127
+ activityReply.error( { 'responseText': xml } );
128
+ return false;
129
+ }
130
+
131
+ response = wpAjax.parseAjaxResponse( xml );
132
+ if ( response.errors ) {
133
+ activityReply.error( { 'responseText': wpAjax.broken } );
134
+ return false;
135
+ }
136
+ response = response.responses[0];
137
+
138
+ // Close and reset the reply row, and add the new Activity item into the list.
139
+ $('#bp-activities-container').fadeOut( '200', function () {
140
+
141
+ // Empty and unfocus the text area
142
+ $( '#bp-activities' ).val( '' ).blur();
143
+
144
+ // Remove any error message and disable the spinner
145
+ $( '#bp-replysubmit .error' ).html( '' ).hide();
146
+ $( '#bp-replysubmit .waiting' ).hide();
147
+
148
+ // Insert new activity item
149
+ $( '#bp-activities-container' ).before( response.data );
150
+
151
+ // Get background colour and animate the flash
152
+ id = $( '#activity-' + response.id );
153
+ bg = id.closest( '.widefat' ).css( 'backgroundColor' );
154
+ id.animate( { 'backgroundColor': '#CEB' }, 300 ).animate( { 'backgroundColor': bg }, 300 );
155
+ });
156
+ }
157
+ };
158
+
159
+ $(document).ready( function () {
160
+ // Create the Activity reply object after domready event
161
+ activityReply.init();
162
+
163
+ // On the edit screen, unload the close/open toggle js for the action & content metaboxes
164
+ $( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
165
+ });
166
+
167
+ })(jQuery);
bp-activity/admin/js/admin.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(b){var a={init:function(){b(document).on("click",".row-actions a.reply",a.open);b(document).on("click","#bp-activities-container a.cancel",a.close);b(document).on("click","#bp-activities-container a.save",a.send);b(document).on("keyup","#bp-activities:visible",function(c){if(27==c.which){a.close()}})},open:function(d){var c=b("#bp-activities-container").hide();b(this).parents("tr").after(c);c.fadeIn("300");b("#bp-activities").focus();return false},close:function(c){b("#bp-activities-container").fadeOut("200",function(){b("#bp-activities").val("").blur();b("#bp-replysubmit .error").html("").hide();b("#bp-replysubmit .waiting").hide()});return false},send:function(d){b("#bp-replysubmit .error").hide();b("#bp-replysubmit .waiting").show();var c={};c["_ajax_nonce-bp-activity-admin-reply"]=b('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val();c.action="bp-activity-admin-reply";c.content=b("#bp-activities").val();c.parent_id=b("#bp-activities-container").prev().data("parent_id");c.root_id=b("#bp-activities-container").prev().data("root_id");b.ajax({data:c,type:"POST",url:ajaxurl,error:function(e){a.error(e)},success:function(e){a.show(e)}});return false},error:function(c){var d=c.statusText;b("#bp-replysubmit .waiting").hide();if(c.responseText){d=c.responseText.replace(/<.[^<>]*?>/g,"")}if(d){b("#bp-replysubmit .error").html(d).show()}},show:function(d){var e,f,c;if(typeof(d)=="string"){a.error({responseText:d});return false}c=wpAjax.parseAjaxResponse(d);if(c.errors){a.error({responseText:wpAjax.broken});return false}c=c.responses[0];b("#bp-activities-container").fadeOut("200",function(){b("#bp-activities").val("").blur();b("#bp-replysubmit .error").html("").hide();b("#bp-replysubmit .waiting").hide();b("#bp-activities-container").before(c.data);f=b("#activity-"+c.id);e=f.closest(".widefat").css("backgroundColor");f.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:e},300)})}};b(document).ready(function(){a.init();b("#bp_activity_action h3, #bp_activity_content h3").unbind("click")})})(jQuery);
bp-activity/bp-activity-actions.php CHANGED
@@ -15,7 +15,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
15
  /**
16
  * Allow core components and dependent plugins to register activity actions
17
  *
18
- * @since 1.2.0
19
  *
20
  * @uses do_action() To call 'bp_register_activity_actions' hook.
21
  */
@@ -27,7 +27,7 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
27
  /**
28
  * Allow core components and dependent plugins to register activity actions
29
  *
30
- * @since 1.2.0
31
  *
32
  * @global object $bp BuddyPress global settings
33
  * @uses bp_is_activity_component()
@@ -88,7 +88,14 @@ function bp_activity_action_permalink_router() {
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
  // Allow redirect to be filtered
@@ -103,11 +110,10 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
103
  /**
104
  * Delete specific activity item and redirect to previous page.
105
  *
106
- * @since 1.1.0
107
  *
108
  * @param int $activity_id Activity id to be deleted. Defaults to 0.
109
  *
110
- * @global object $bp BuddyPress global settings
111
  * @uses bp_is_activity_component()
112
  * @uses bp_is_current_action()
113
  * @uses bp_action_variable()
@@ -122,7 +128,6 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
122
  * @return bool False on failure
123
  */
124
  function bp_activity_action_delete_activity( $activity_id = 0 ) {
125
- global $bp;
126
 
127
  // Not viewing activity or action is not delete
128
  if ( !bp_is_activity_component() || !bp_is_current_action( 'delete' ) )
@@ -164,12 +169,65 @@ function bp_activity_action_delete_activity( $activity_id = 0 ) {
164
  }
165
  add_action( 'bp_actions', 'bp_activity_action_delete_activity' );
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  /**
168
  * Post user/group activity update.
169
  *
170
- * @since 1.2.0
171
  *
172
- * @global object $bp BuddyPress global settings
173
  * @uses is_user_logged_in()
174
  * @uses bp_is_activity_component()
175
  * @uses bp_is_current_action()
@@ -187,7 +245,6 @@ add_action( 'bp_actions', 'bp_activity_action_delete_activity' );
187
  * @return bool False on failure
188
  */
189
  function bp_activity_action_post_update() {
190
- global $bp;
191
 
192
  // Do not proceed if user is not logged in, not viewing activity, or not posting
193
  if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'post' ) )
@@ -213,7 +270,7 @@ function bp_activity_action_post_update() {
213
 
214
  // Post to groups object
215
  } else if ( 'groups' == $object && bp_is_active( 'groups' ) ) {
216
- if ( (int)$item_id ) {
217
  $activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
218
  }
219
 
@@ -236,9 +293,8 @@ add_action( 'bp_actions', 'bp_activity_action_post_update' );
236
  /**
237
  * Post new activity comment.
238
  *
239
- * @since 1.2.0
240
  *
241
- * @global object $bp BuddyPress global settings
242
  * @uses is_user_logged_in()
243
  * @uses bp_is_activity_component()
244
  * @uses bp_is_current_action()
@@ -253,9 +309,8 @@ add_action( 'bp_actions', 'bp_activity_action_post_update' );
253
  * @return bool False on failure
254
  */
255
  function bp_activity_action_post_comment() {
256
- global $bp;
257
 
258
- if ( !is_user_logged_in() || ( bp_is_activity_component() ) || !bp_is_current_action( 'reply' ) )
259
  return false;
260
 
261
  // Check the nonce
@@ -287,9 +342,8 @@ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
287
  /**
288
  * Mark activity as favorite.
289
  *
290
- * @since 1.2.0
291
  *
292
- * @global object $bp BuddyPress global settings
293
  * @uses is_user_logged_in()
294
  * @uses bp_is_activity_component()
295
  * @uses bp_is_current_action()
@@ -303,9 +357,8 @@ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
303
  * @return bool False on failure
304
  */
305
  function bp_activity_action_mark_favorite() {
306
- global $bp;
307
 
308
- if ( !is_user_logged_in() || ( bp_is_activity_component() ) || !bp_is_current_action( 'favorite' ) )
309
  return false;
310
 
311
  // Check the nonce
@@ -323,9 +376,8 @@ add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
323
  /**
324
  * Remove activity from favorites.
325
  *
326
- * @since 1.2.0
327
  *
328
- * @global object $bp BuddyPress global settings
329
  * @uses is_user_logged_in()
330
  * @uses bp_is_activity_component()
331
  * @uses bp_is_current_action()
@@ -339,9 +391,8 @@ add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
339
  * @return bool False on failure
340
  */
341
  function bp_activity_action_remove_favorite() {
342
- global $bp;
343
 
344
- if ( !is_user_logged_in() || ( bp_is_activity_component() ) || !bp_is_current_action( 'unfavorite' ) )
345
  return false;
346
 
347
  // Check the nonce
@@ -359,7 +410,7 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
359
  /**
360
  * Load the sitewide feed.
361
  *
362
- * @since 1.0.0
363
  *
364
  * @global object $bp BuddyPress global settings
365
  * @global object $wp_query
@@ -387,9 +438,8 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
387
  /**
388
  * Load a user's personal feed.
389
  *
390
- * @since 1.0.0
391
  *
392
- * @global object $bp BuddyPress global settings
393
  * @global object $wp_query
394
  * @uses bp_is_user_activity()
395
  * @uses bp_is_current_action()
@@ -398,7 +448,7 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
398
  * @return bool False on failure
399
  */
400
  function bp_activity_action_personal_feed() {
401
- global $bp, $wp_query;
402
 
403
  if ( !bp_is_user_activity() || !bp_is_current_action( 'feed' ) )
404
  return false;
@@ -414,9 +464,8 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
414
  /**
415
  * Load a user's friends feed.
416
  *
417
- * @since 1.0.0
418
  *
419
- * @global object $bp BuddyPress global settings
420
  * @global object $wp_query
421
  * @uses bp_is_active()
422
  * @uses bp_is_user_activity()
@@ -428,7 +477,7 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
428
  * @return bool False on failure
429
  */
430
  function bp_activity_action_friends_feed() {
431
- global $bp, $wp_query;
432
 
433
  if ( !bp_is_active( 'friends' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_friends_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
434
  return false;
@@ -444,9 +493,8 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
444
  /**
445
  * Load a user's my groups feed.
446
  *
447
- * @since 1.2.0
448
  *
449
- * @global object $bp BuddyPress global settings
450
  * @global object $wp_query
451
  * @uses bp_is_active()
452
  * @uses bp_is_user_activity()
@@ -458,7 +506,7 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
458
  * @return bool False on failure
459
  */
460
  function bp_activity_action_my_groups_feed() {
461
- global $bp, $wp_query;
462
 
463
  if ( !bp_is_active( 'groups' ) || !bp_is_user_activity() || !bp_is_current_action( bp_get_groups_slug() ) || !bp_is_action_variable( 'feed', 0 ) )
464
  return false;
@@ -474,9 +522,8 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
474
  /**
475
  * Load a user's @mentions feed.
476
  *
477
- * @since 1.2.0
478
  *
479
- * @global object $bp BuddyPress global settings
480
  * @global object $wp_query
481
  * @uses bp_is_user_activity()
482
  * @uses bp_is_current_action()
@@ -486,7 +533,7 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
486
  * @return bool False on failure
487
  */
488
  function bp_activity_action_mentions_feed() {
489
- global $bp, $wp_query;
490
 
491
  if ( !bp_is_user_activity() || !bp_is_current_action( 'mentions' ) || !bp_is_action_variable( 'feed', 0 ) )
492
  return false;
@@ -502,9 +549,8 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
502
  /**
503
  * Load a user's favorites feed.
504
  *
505
- * @since 1.2.0
506
  *
507
- * @global object $bp BuddyPress global settings
508
  * @global object $wp_query
509
  * @uses bp_is_user_activity()
510
  * @uses bp_is_current_action()
@@ -514,7 +560,7 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
514
  * @return bool False on failure
515
  */
516
  function bp_activity_action_favorites_feed() {
517
- global $bp, $wp_query;
518
 
519
  if ( !bp_is_user_activity() || !bp_is_current_action( 'favorites' ) || !bp_is_action_variable( 'feed', 0 ) )
520
  return false;
@@ -527,4 +573,29 @@ function bp_activity_action_favorites_feed() {
527
  }
528
  add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
529
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  ?>
15
  /**
16
  * Allow core components and dependent plugins to register activity actions
17
  *
18
+ * @since BuddyPress (1.2)
19
  *
20
  * @uses do_action() To call 'bp_register_activity_actions' hook.
21
  */
27
  /**
28
  * Allow core components and dependent plugins to register activity actions
29
  *
30
+ * @since BuddyPress (1.2)
31
  *
32
  * @global object $bp BuddyPress global settings
33
  * @uses bp_is_activity_component()
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
110
  /**
111
  * Delete specific activity item and redirect to previous page.
112
  *
113
+ * @since BuddyPress (1.1)
114
  *
115
  * @param int $activity_id Activity id to be deleted. Defaults to 0.
116
  *
 
117
  * @uses bp_is_activity_component()
118
  * @uses bp_is_current_action()
119
  * @uses bp_action_variable()
128
  * @return bool False on failure
129
  */
130
  function bp_activity_action_delete_activity( $activity_id = 0 ) {
 
131
 
132
  // Not viewing activity or action is not delete
133
  if ( !bp_is_activity_component() || !bp_is_current_action( 'delete' ) )
169
  }
170
  add_action( 'bp_actions', 'bp_activity_action_delete_activity' );
171
 
172
+ /**
173
+ * Mark specific activity item as spam and redirect to previous page
174
+ *
175
+ * @global object $bp BuddyPress global settings
176
+ * @param int $activity_id Activity id to be deleted. Defaults to 0.
177
+ * @return bool False on failure
178
+ * @since 1.6
179
+ */
180
+ function bp_activity_action_spam_activity( $activity_id = 0 ) {
181
+ global $bp;
182
+
183
+ // Not viewing activity, or action is not spam, or Akismet isn't present
184
+ if ( !bp_is_activity_component() || !bp_is_current_action( 'spam' ) || empty( $bp->activity->akismet ) )
185
+ return false;
186
+
187
+ if ( empty( $activity_id ) && bp_action_variable( 0 ) )
188
+ $activity_id = (int) bp_action_variable( 0 );
189
+
190
+ // Not viewing a specific activity item
191
+ if ( empty( $activity_id ) )
192
+ return false;
193
+
194
+ // Is the current user allowed to spam items?
195
+ if ( !bp_activity_user_can_mark_spam() )
196
+ return false;
197
+
198
+ // Load up the activity item
199
+ $activity = new BP_Activity_Activity( $activity_id );
200
+ if ( empty( $activity->id ) )
201
+ return false;
202
+
203
+ // Check nonce
204
+ check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id );
205
+
206
+ // Call an action before the spamming so plugins can modify things if they want to
207
+ do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity );
208
+
209
+ // Mark as spam
210
+ bp_activity_mark_as_spam( $activity );
211
+ $activity->save();
212
+
213
+ // Tell the user the spamming has been succesful
214
+ bp_core_add_message( __( 'The activity item has been marked as spam and is no longer visible.', 'buddypress' ) );
215
+
216
+ do_action( 'bp_activity_action_spam_activity', $activity_id, $activity->user_id );
217
+
218
+ // Check for the redirect query arg, otherwise let WP handle things
219
+ if ( !empty( $_GET['redirect_to'] ) )
220
+ bp_core_redirect( esc_url( $_GET['redirect_to'] ) );
221
+ else
222
+ bp_core_redirect( wp_get_referer() );
223
+ }
224
+ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
225
+
226
  /**
227
  * Post user/group activity update.
228
  *
229
+ * @since BuddyPress (1.2)
230
  *
 
231
  * @uses is_user_logged_in()
232
  * @uses bp_is_activity_component()
233
  * @uses bp_is_current_action()
245
  * @return bool False on failure
246
  */
247
  function bp_activity_action_post_update() {
 
248
 
249
  // Do not proceed if user is not logged in, not viewing activity, or not posting
250
  if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'post' ) )
270
 
271
  // Post to groups object
272
  } else if ( 'groups' == $object && bp_is_active( 'groups' ) ) {
273
+ if ( (int) $item_id ) {
274
  $activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
275
  }
276
 
293
  /**
294
  * Post new activity comment.
295
  *
296
+ * @since BuddyPress (1.2)
297
  *
 
298
  * @uses is_user_logged_in()
299
  * @uses bp_is_activity_component()
300
  * @uses bp_is_current_action()
309
  * @return bool False on failure
310
  */
311
  function bp_activity_action_post_comment() {
 
312
 
313
+ if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'reply' ) )
314
  return false;
315
 
316
  // Check the nonce
342
  /**
343
  * Mark activity as favorite.
344
  *
345
+ * @since BuddyPress (1.2)
346
  *
 
347
  * @uses is_user_logged_in()
348
  * @uses bp_is_activity_component()
349
  * @uses bp_is_current_action()
357
  * @return bool False on failure
358
  */
359
  function bp_activity_action_mark_favorite() {
 
360
 
361
+ if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'favorite' ) )
362
  return false;
363
 
364
  // Check the nonce
376
  /**
377
  * Remove activity from favorites.
378
  *
379
+ * @since BuddyPress (1.2)
380
  *
 
381
  * @uses is_user_logged_in()
382
  * @uses bp_is_activity_component()
383
  * @uses bp_is_current_action()
391
  * @return bool False on failure
392
  */
393
  function bp_activity_action_remove_favorite() {
 
394
 
395
+ if ( ! is_user_logged_in() || ! bp_is_activity_component() || ! bp_is_current_action( 'unfavorite' ) )
396
  return false;
397
 
398
  // Check the nonce
410
  /**
411
  * Load the sitewide feed.
412
  *
413
+ * @since BuddyPress (1.0)
414
  *
415
  * @global object $bp BuddyPress global settings
416
  * @global object $wp_query
438
  /**
439
  * Load a user's personal feed.
440
  *
441
+ * @since BuddyPress (1.0)
442
  *
 
443
  * @global object $wp_query
444
  * @uses bp_is_user_activity()
445
  * @uses bp_is_current_action()
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;
464
  /**
465
  * Load a user's friends feed.
466
  *
467
+ * @since BuddyPress (1.0)
468
  *
 
469
  * @global object $wp_query
470
  * @uses bp_is_active()
471
  * @uses bp_is_user_activity()
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;
493
  /**
494
  * Load a user's my groups feed.
495
  *
496
+ * @since BuddyPress (1.2)
497
  *
 
498
  * @global object $wp_query
499
  * @uses bp_is_active()
500
  * @uses bp_is_user_activity()
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;
522
  /**
523
  * Load a user's @mentions feed.
524
  *
525
+ * @since BuddyPress (1.2)
526
  *
 
527
  * @global object $wp_query
528
  * @uses bp_is_user_activity()
529
  * @uses bp_is_current_action()
533
  * @return bool False on failure
534
  */
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;
549
  /**
550
  * Load a user's favorites feed.
551
  *
552
+ * @since BuddyPress (1.2)
553
  *
 
554
  * @global object $wp_query
555
  * @uses bp_is_user_activity()
556
  * @uses bp_is_current_action()
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;
573
  }
574
  add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
575
 
576
+ /**
577
+ * Loads Akismet
578
+ *
579
+ * @global object $bp BuddyPress global settings
580
+ * @since 1.6
581
+ */
582
+ function bp_activity_setup_akismet() {
583
+ global $bp;
584
+
585
+ // Bail if Akismet is not active
586
+ if ( ! defined( 'AKISMET_VERSION' ) )
587
+ return;
588
+
589
+ // Bail if no Akismet key is set
590
+ if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) )
591
+ return;
592
+
593
+ // Bail if BuddyPress Activity Akismet support has been disabled by another plugin
594
+ if ( ! apply_filters( 'bp_activity_use_akismet', true ) )
595
+ return;
596
+
597
+ // Instantiate Akismet for BuddyPress
598
+ $bp->activity->akismet = new BP_Akismet();
599
+ }
600
+
601
  ?>
bp-activity/bp-activity-admin.php ADDED
@@ -0,0 +1,1393 @@