Skip to:
Content

Ticket #7325: 7325-activity-anonymous-functions.diff

File 7325-activity-anonymous-functions.diff, 2.5 KB (added by tw2113, 13 months ago)
  • src/bp-activity/bp-activity-actions.php

    diff --git src/bp-activity/bp-activity-actions.php src/bp-activity/bp-activity-actions.php
    index 4448088..7e57216 100644
    function bp_activity_transition_post_type_comment_status( $new_status, $old_stat 
    832832 
    833833        // Add "new_post_type_comment" to the whitelisted activity types, so that the activity's Akismet history is generated 
    834834        $post_type_comment_action = $activity_comment_object->action_id; 
    835         $comment_akismet_history = create_function( '$t', '$t[] = $post_type_comment_action; return $t;' ); 
     835        $comment_akismet_history = function ( $activity_types ) use ( $post_type_comment_action ) { 
     836                $activity_types[] = $post_type_comment_action; 
     837 
     838                return $activity_types; 
     839        }; 
    836840        add_filter( 'bp_akismet_get_activity_types', $comment_akismet_history ); 
    837841 
    838842        // Make sure the activity change won't edit the comment if sync is on 
  • src/bp-activity/bp-activity-functions.php

    diff --git src/bp-activity/bp-activity-functions.php src/bp-activity/bp-activity-functions.php
    index b9b8a09..545c1db 100644
    add_action( 'bp_before_activity_comment', 'bp_activity_comment_embed' ); 
    36753675function bp_dtheme_embed_read_more( $activity ) { 
    36763676        buddypress()->activity->read_more_id = $activity->id; 
    36773677 
    3678         add_filter( 'embed_post_id',         create_function( '', 'return buddypress()->activity->read_more_id;' ) ); 
     3678        add_filter( 'embed_post_id',         function() { return buddypress()->activity->read_more_id; } ); 
    36793679        add_filter( 'bp_embed_get_cache',    'bp_embed_activity_cache',      10, 3 ); 
    36803680        add_action( 'bp_embed_update_cache', 'bp_embed_activity_save_cache', 10, 3 ); 
    36813681} 
  • src/bp-activity/classes/class-bp-activity-list-table.php

    diff --git src/bp-activity/classes/class-bp-activity-list-table.php src/bp-activity/classes/class-bp-activity-list-table.php
    index 0e3a488..72c056a 100644
    class BP_Activity_List_Table extends WP_List_Table { 
    171171                        $activities['total']      = count( $activities['activities'] ); 
    172172 
    173173                        // Sort the array by the activity object's date_recorded value. 
    174                         usort( $activities['activities'], create_function( '$a, $b', 'return $a->date_recorded > $b->date_recorded;' ) ); 
     174                        usort( $activities['activities'], function( $a, $b ) { return $a->date_recorded > $b->date_recorded; } ); 
    175175                } 
    176176 
    177177                // The bp_activity_get function returns an array of objects; cast these to arrays for WP_List_Table.