Changeset 12527
- Timestamp:
- 01/18/2020 12:30:19 PM (5 years ago)
- Location:
- trunk/src/bp-activity
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-admin.php
r12523 r12527 76 76 $root_id = ! empty( $_REQUEST['root_id'] ) ? (int) $_REQUEST['root_id'] : 0; 77 77 78 // $parent_id is required 78 // $parent_id is required. 79 79 if ( empty( $parent_id ) ) 80 80 die( '-1' ); -
trunk/src/bp-activity/bp-activity-adminbar.php
r12495 r12527 27 27 } 28 28 29 // Only show this menu to super admins 29 // Only show this menu to super admins. 30 30 if ( ! bp_current_user_can( 'bp_moderate' ) ) { 31 31 return; -
trunk/src/bp-activity/bp-activity-akismet.php
r11360 r12527 61 61 $interval = max( 1, absint( $interval ) ); 62 62 63 // _bp_akismet_submission meta values are large, so expire them after $interval days regardless of the activity status 63 // _bp_akismet_submission meta values are large, so expire them after $interval days regardless of the activity status. 64 64 $sql = $wpdb->prepare( "SELECT a.id FROM {$bp->activity->table_name} a LEFT JOIN {$bp->activity->table_name_meta} m ON a.id = m.activity_id WHERE m.meta_key = %s AND DATE_SUB(%s, INTERVAL {$interval} DAY) > a.date_recorded LIMIT 10000", '_bp_akismet_submission', current_time( 'mysql', 1 ) ); 65 65 $activity_ids = $wpdb->get_col( $sql ); -
trunk/src/bp-activity/bp-activity-embeds.php
r12264 r12527 101 101 $activity = reset( $activity ); 102 102 103 // No need to requery if we already got the embed activity 103 // No need to requery if we already got the embed activity. 104 104 if ( (int) $activity_id === $activity->id ) { 105 105 return $activities_template->has_activities(); … … 262 262 } 263 263 264 // Thumb width 264 // Thumb width. 265 265 $thumb_width = isset( $oembed->thumbnail_width ) && 'photo' !== $oembed->type && (int) $oembed->thumbnail_width < 550 ? (int) $oembed->thumbnail_width : $width; 266 266 … … 275 275 } 276 276 277 // Show description (non-oEmbed standard) 277 // Show description (non-oEmbed standard). 278 278 if ( isset( $oembed->description ) ) { 279 279 $caption .= sprintf( '<div class="caption-description">%s</div>', apply_filters( 'bp_activity_get_embed_excerpt', $oembed->description ) ); -
trunk/src/bp-activity/bp-activity-functions.php
r12393 r12527 598 598 599 599 if ( ! empty( $track_post_type ) ) { 600 // Set the post type comments tracking args 600 // Set the post type comments tracking args. 601 601 if ( ! empty( $track_post_type->comments_tracking->action_id ) ) { 602 // Used to check support for comment tracking by activity type (new_post_type_comment) 602 // Used to check support for comment tracking by activity type (new_post_type_comment). 603 603 $track_post_type->comments_tracking->comments_tracking = true; 604 604 … … 608 608 $post_types_tracking_args[ $track_post_type->comments_tracking->action_id ] = $track_post_type->comments_tracking; 609 609 610 // Used to check support for comment tracking by activity type (new_post_type) 610 // Used to check support for comment tracking by activity type (new_post_type). 611 611 $track_post_type->comments_tracking = true; 612 612 } … … 651 651 */ 652 652 case 'post-type-comment-tracking' : 653 // Set the activity track global if not set yet 653 // Set the activity track global if not set yet. 654 654 if ( empty( $bp->activity->track ) ) { 655 655 $bp->activity->track = bp_activity_get_post_types_tracking_args(); … … 727 727 $bp = buddypress(); 728 728 729 // Set the activity track global if not set yet 729 // Set the activity track global if not set yet. 730 730 if ( empty( $bp->activity->track ) ) { 731 731 $bp->activity->track = bp_activity_get_post_types_tracking_args(); … … 1703 1703 'fields' => 'all', 1704 1704 'page' => 1, // Page 1 without a per_page will result in no pagination. 1705 'per_page' => false, // results per page 1706 'sort' => 'DESC', // sort ASC or DESC 1705 'per_page' => false, // results per page. 1706 'sort' => 'DESC', // sort ASC or DESC. 1707 1707 'display_comments' => false, // False for no comments. 'stream' for within stream display, 'threaded' for below each activity item. 1708 1708 1709 'search_terms' => false, // Pass search terms as a string 1710 'meta_query' => false, // Filter by activity meta. See WP_Meta_Query for format 1709 'search_terms' => false, // Pass search terms as a string. 1710 'meta_query' => false, // Filter by activity meta. See WP_Meta_Query for format. 1711 1711 'date_query' => false, // Filter by date. See first parameter of WP_Date_Query for format. 1712 1712 'filter_query' => false, 1713 1713 'show_hidden' => false, // Show activity items that are hidden site-wide? 1714 1714 'exclude' => false, // Comma-separated list of activity IDs to exclude. 1715 'in' => false, // Comma-separated list or array of activity IDs to which you 1715 'in' => false, // Comma-separated list or array of activity IDs to which you. 1716 1716 // want to limit the query. 1717 1717 'spam' => 'ham_only', // 'ham_only' (default), 'spam_only' or 'all'. … … 1862 1862 $r = bp_parse_args( $args, array( 1863 1863 'id' => false, // Pass an existing activity ID to update an existing entry. 1864 'action' => '', // The activity action - e.g. "Jon Doe posted an update" 1865 'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!" 1864 'action' => '', // The activity action - e.g. "Jon Doe posted an update". 1865 'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!". 1866 1866 'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent. 1867 1867 'type' => false, // The activity type e.g. activity_update, profile_updated. … … 2299 2299 */ 2300 2300 function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $activity_post_object = null ) { 2301 // Get the users comment 2301 // Get the users comment. 2302 2302 $post_type_comment = get_comment( $comment_id ); 2303 2303 2304 // Don't record activity if the comment hasn't been approved 2304 // Don't record activity if the comment hasn't been approved. 2305 2305 if ( empty( $is_approved ) ) { 2306 2306 return false; 2307 2307 } 2308 2308 2309 // Don't record activity if no email address has been included 2309 // Don't record activity if no email address has been included. 2310 2310 if ( empty( $post_type_comment->comment_author_email ) ) { 2311 2311 return false; 2312 2312 } 2313 2313 2314 // Don't record activity if the comment has already been marked as spam 2314 // Don't record activity if the comment has already been marked as spam. 2315 2315 if ( 'spam' === $is_approved ) { 2316 2316 return false; … … 2320 2320 $user = get_user_by( 'email', $post_type_comment->comment_author_email ); 2321 2321 2322 // If user isn't registered, don't record activity 2322 // If user isn't registered, don't record activity. 2323 2323 if ( empty( $user ) ) { 2324 2324 return false; 2325 2325 } 2326 2326 2327 // Get the user_id 2327 // Get the user_id. 2328 2328 $user_id = (int) $user->ID; 2329 2329 2330 // Get blog and post data 2330 // Get blog and post data. 2331 2331 $blog_id = get_current_blog_id(); 2332 2332 2333 // Get the post 2333 // Get the post. 2334 2334 $post_type_comment->post = get_post( $post_type_comment->comment_post_ID ); 2335 2335 … … 2347 2347 $is_post_status_not_allowed = (bool) apply_filters( 'bp_activity_post_type_is_post_status_allowed', 'publish' !== $post_type_comment->post->post_status || ! empty( $post_type_comment->post->post_password ) ); 2348 2348 2349 // If this is a password protected post, or not a public post don't record the comment 2349 // If this is a password protected post, or not a public post don't record the comment. 2350 2350 if ( $is_post_status_not_allowed ) { 2351 2351 return false; 2352 2352 } 2353 2353 2354 // Set post type 2354 // Set post type. 2355 2355 $post_type = $post_type_comment->post->post_type; 2356 2356 … … 2359 2359 $activity_post_object = bp_activity_get_post_type_tracking_args( $post_type ); 2360 2360 2361 // Bail if the activity type does not exist 2361 // Bail if the activity type does not exist. 2362 2362 if ( empty( $activity_post_object->comments_tracking->action_id ) ) { 2363 2363 return false; … … 2365 2365 } 2366 2366 2367 // Set the $activity_comment_object 2367 // Set the $activity_comment_object. 2368 2368 $activity_comment_object = $activity_post_object->comments_tracking; 2369 2369 … … 2504 2504 $activity_post_object = bp_activity_get_post_type_tracking_args( $post_type ); 2505 2505 2506 // Bail if the activity type does not exist 2506 // Bail if the activity type does not exist. 2507 2507 if ( empty( $activity_post_object->comments_tracking->action_id ) ) { 2508 2508 return false; … … 2510 2510 } 2511 2511 2512 // Set the $activity_comment_object 2512 // Set the $activity_comment_object. 2513 2513 $activity_comment_object = $activity_post_object->comments_tracking; 2514 2514 … … 4033 4033 $activity_post_object = bp_activity_get_post_type_tracking_args( $post_type ); 4034 4034 4035 // Bail if the activity type does not exist 4035 // Bail if the activity type does not exist. 4036 4036 if ( empty( $activity_post_object->comments_tracking->action_id ) ) { 4037 4037 return false; 4038 4038 4039 // Set the $activity_comment_object 4039 // Set the $activity_comment_object. 4040 4040 } else { 4041 4041 $activity_comment_object = $activity_post_object->comments_tracking; 4042 4042 } 4043 4043 4044 // Init an empty activity ID 4044 // Init an empty activity ID. 4045 4045 $activity_id = 0; 4046 4046 … … 4066 4066 } 4067 4067 4068 // Get the activity 4068 // Get the activity. 4069 4069 if ( bp_disable_blogforum_comments() ) { 4070 4070 $activity_id = bp_activity_get_activity_id( array( … … 4094 4094 } 4095 4095 4096 // Check activity item exists 4096 // Check activity item exists. 4097 4097 if ( empty( $activity_id ) ) { 4098 4098 // If no activity exists, but the comment has been approved, record it into the activity table. … … 4104 4104 } 4105 4105 4106 // Create an activity object 4106 // Create an activity object. 4107 4107 $activity = new BP_Activity_Activity( $activity_id ); 4108 4108 if ( empty( $activity->component ) ) { … … 4110 4110 } 4111 4111 4112 // Spam/ham the activity if it's not already in that state 4112 // Spam/ham the activity if it's not already in that state. 4113 4113 if ( 'spam_activity' === $action && ! $activity->is_spam ) { 4114 4114 bp_activity_mark_as_spam( $activity ); … … 4117 4117 } 4118 4118 4119 // Add "new_post_type_comment" to the whitelisted activity types, so that the activity's Akismet history is generated 4119 // Add "new_post_type_comment" to the whitelisted activity types, so that the activity's Akismet history is generated. 4120 4120 $post_type_comment_action = $activity_comment_object->action_id; 4121 4121 $comment_akismet_history = function ( $activity_types ) use ( $post_type_comment_action ) { … … 4126 4126 add_filter( 'bp_akismet_get_activity_types', $comment_akismet_history ); 4127 4127 4128 // Make sure the activity change won't edit the comment if sync is on 4128 // Make sure the activity change won't edit the comment if sync is on. 4129 4129 remove_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 ); 4130 4130 4131 // Save the updated activity 4131 // Save the updated activity. 4132 4132 $activity->save(); 4133 4133 4134 // Restore the action 4134 // Restore the action. 4135 4135 add_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 ); 4136 4136 4137 // Remove the "new_blog_comment" activity type whitelist so we don't break anything 4137 // Remove the "new_blog_comment" activity type whitelist so we don't break anything. 4138 4138 remove_filter( 'bp_akismet_get_activity_types', $comment_akismet_history ); 4139 4139 } -
trunk/src/bp-activity/screens/permalink.php
r11885 r12527 27 27 $activity = bp_activity_get_specific( array( 'activity_ids' => bp_action_variable( 0 ), 'show_hidden' => true ) ); 28 28 29 // 404 if activity does not exist 29 // 404 if activity does not exist. 30 30 if ( empty( $activity['activities'][0] ) ) { 31 31 bp_do_404(); … … 107 107 ) ); 108 108 109 // 404 if activity does not exist 109 // 404 if activity does not exist. 110 110 if ( empty( $activity['activities'][0] ) || bp_action_variables() ) { 111 111 bp_do_404();
Note: See TracChangeset
for help on using the changeset viewer.