Skip to:
Content

BuddyPress.org

Ticket #6865: 6865.2.diff

File 6865.2.diff, 1.5 KB (added by boonebgorges, 8 years ago)
  • src/bp-activity/bp-activity-functions.php

    diff --git src/bp-activity/bp-activity-functions.php src/bp-activity/bp-activity-functions.php
    index b5e8a93..a908342 100644
    function bp_activity_get_actions() { 
    554554
    555555        $post_types = bp_activity_get_post_types_tracking_args();
    556556
     557        $do_sort = false;
     558
    557559        // Create the actions for the post types, if they haven't already been created.
    558560        if ( ! empty( $post_types ) ) {
    559561                foreach ( $post_types as $post_type ) {
    function bp_activity_get_actions() { 
    570572                                $post_type->contexts,
    571573                                $post_type->position
    572574                        );
     575
     576                        $do_sort = true;
    573577                }
    574578        }
    575579
    576         // Sort the actions by their position within each component.
    577         foreach ( $bp->activity->actions as $component => $actions ) {
    578                 $actions = (array) $actions;
    579                 $temp = bp_sort_by_key( $actions, 'position', 'num' );
     580        // If the actions have been modified, sort by their position within each component.
     581        if ( $do_sort ) {
     582                foreach ( $bp->activity->actions as $component => $actions ) {
     583                        $actions = (array) $actions;
     584                        $temp = bp_sort_by_key( $actions, 'position', 'num' );
    580585
    581                 // Restore keys.
    582                 $bp->activity->actions->{$component} = new stdClass;
    583                 foreach ( $temp as $key_ordered ) {
    584                         $bp->activity->actions->{$component}->{$key_ordered['key']} = $key_ordered;
     586                        // Restore keys.
     587                        $bp->activity->actions->{$component} = new stdClass;
     588                        foreach ( $temp as $key_ordered ) {
     589                                $bp->activity->actions->{$component}->{$key_ordered['key']} = $key_ordered;
     590                        }
    585591                }
    586592        }
    587593