Ticket #5936: bp-activity-actions-5936.diff
File bp-activity-actions-5936.diff, 6.1 KB (added by , 10 years ago) |
---|
-
src/bp-activity/bp-activity-actions.php
20 20 * @uses do_action() To call 'bp_register_activity_actions' hook. 21 21 */ 22 22 function bp_register_activity_actions() { 23 24 /** 25 * Fires on bp_init to allow core componants and dependent plugins to register activity actions. 26 * 27 * @since 1.2 28 */ 23 29 do_action( 'bp_register_activity_actions' ); 24 30 } 25 31 add_action( 'bp_init', 'bp_register_activity_actions', 8 ); … … 96 102 $redirect = add_query_arg( urlencode_deep( $query_frags ), $redirect ); 97 103 } 98 104 99 // Allow redirect to be filtered 105 /** 106 * Filter the intended redirect url before the redirect occurs for the single activity item. 107 * 108 * @since 1.2.2 109 * 110 * @param array Array with url to redirect to and activity related to the redirect. 111 */ 100 112 if ( ! $redirect = apply_filters_ref_array( 'bp_activity_permalink_redirect_url', array( $redirect, &$activity ) ) ) { 101 113 bp_core_redirect( bp_get_root_domain() ); 102 114 } … … 149 161 if ( ! bp_activity_user_can_delete( $activity ) ) 150 162 return false; 151 163 152 // Call the action before the delete so plugins can still fetch information about it 164 /** 165 * Fires before the deletion so plugins can still fetch information about it. 166 * 167 * @since 1.5 168 * 169 * @param int $activity_id The activity ID. 170 * @param int $user_id The user associated with the activity. 171 */ 153 172 do_action( 'bp_activity_before_action_delete_activity', $activity_id, $activity->user_id ); 154 173 155 174 // Delete the activity item and provide user feedback … … 158 177 else 159 178 bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' ); 160 179 180 /** 181 * Fires after the deletion so plugins can act afterwards based on the activity. 182 * 183 * @since 1.1 184 * 185 * @param int $activity_id The activity ID. 186 * @param int $user_id The user associated with the activity. 187 */ 161 188 do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id ); 162 189 163 190 // Check for the redirect query arg, otherwise let WP handle things … … 203 230 // Check nonce 204 231 check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id ); 205 232 206 // Call an action before the spamming so plugins can modify things if they want to 233 /** 234 * Fires before the marking activity as spam so plugins can modify things if they want to. 235 * 236 * @since 1.6 237 * 238 * @param int $activty_id Activity ID to be marked as spam. 239 * @param object $activity Activity object for the ID to be marked as spam. 240 */ 207 241 do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity ); 208 242 209 243 // Mark as spam … … 213 247 // Tell the user the spamming has been succesful 214 248 bp_core_add_message( __( 'The activity item has been marked as spam and is no longer visible.', 'buddypress' ) ); 215 249 250 /** 251 * Fires after the marking activity as spam so plugins can act afterwards based on the activity. 252 * 253 * @since 1.6 254 * 255 * @param int $activty_id Activity ID that was marked as spam. 256 * @param int $user_id User ID associated with activity. 257 */ 216 258 do_action( 'bp_activity_action_spam_activity', $activity_id, $activity->user_id ); 217 259 218 260 // Check for the redirect query arg, otherwise let WP handle things … … 253 295 // Check the nonce 254 296 check_admin_referer( 'post_update', '_wpnonce_post_update' ); 255 297 256 // Get activity info 298 /** 299 * Filters the content provided in the activity input field. 300 * 301 * @since 1.2 302 * 303 * @param string $whats-new Activity message being posted. 304 */ 257 305 $content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] ); 258 306 259 307 if ( ! empty( $_POST['whats-new-post-object'] ) ) { 308 309 /** 310 * Filters the item type that the activity update should be associated with. 311 * 312 * @since 1.2 313 * 314 * @param string $whats-new-post-object Item type to associate with. 315 */ 260 316 $object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] ); 261 317 } 262 318 263 319 if ( ! empty( $_POST['whats-new-post-in'] ) ) { 320 321 /** 322 * Filters what component the activity is being to. 323 * 324 * @since 1.2 325 * 326 * @param string $whats-new-post-in Chosen component to post activity to. 327 */ 264 328 $item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] ); 265 329 } 266 330 … … 280 344 $activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) ); 281 345 } 282 346 283 // Special circumstance so let filters handle it284 347 } else { 348 349 /** 350 * Filters activity object for BuddyPress core and plugin authors before posting activity update. 351 * 352 * @since 1.2 353 * 354 * @param string $object Activity item being associated to. 355 * @param string $item_id Component ID being posted to. 356 * @param string $content Activity content being posted. 357 */ 285 358 $activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content ); 286 359 } 287 360 … … 322 395 // Check the nonce 323 396 check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' ); 324 397 398 /** 399 * Filters the activity ID a comment will be in reply to. 400 * 401 * @since 1.2 402 * 403 * @param string $comment_form_id ID of the activity being replied to. 404 */ 325 405 $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] ); 406 407 /** 408 * Filters the comment content for a comment reply. 409 * 410 * @since 1.2 411 * 412 * @param string $ac_input_activity_id Comment content being posted. 413 */ 326 414 $content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] ); 327 415 328 416 if ( empty( $content ) ) { … … 640 728 if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) ) 641 729 return; 642 730 643 // Bail if BuddyPress Activity Akismet support has been disabled by another plugin 731 /** 732 * Filters if BuddyPress Activity Akismet support has been disabled by another plugin. 733 * 734 * @since 1.6 735 * 736 * @param bool bp_is_akismet_active Return value of bp_is_akismet_active boolean function. 737 */ 644 738 if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) 645 739 return; 646 740