Skip to:
Content

BuddyPress.org

Changeset 9382


Ignore:
Timestamp:
01/20/2015 06:50:52 PM (12 years ago)
Author:
boonebgorges
Message:

In bp_activity_generate_action_string(), use bp_activity_get_actions() rather than touching global directly.

This change ensures that the filters called by bp_activity_get_actions() are
run, which gives a chance for dynamically registered actions to register
themselves just in time whenever an activity string needs to be generated.

This change is a more general fix than the one introduced in [9366], so that
changeset (minus its unit tests) has been rolled back. See #6126.

Fixes #6141.

Location:
trunk/src/bp-activity
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-classes.php

    r9380 r9382  
    163163                        $this->is_spam           = $row->is_spam;
    164164                }
    165 
    166                 /**
    167                  * Make sure the activity actions have been registered.
    168                  * We can't assume it will already be set because this is normally only done on an ad-hoc basis.
    169                  *
    170                  * @link https://buddypress.trac.wordpress.org/ticket/6126
    171                  */
    172                 bp_activity_get_actions();
    173165
    174166                // Generate dynamic 'action' when possible
  • trunk/src/bp-activity/bp-activity-functions.php

    r9351 r9382  
    12501250
    12511251        // Check for registered format callback
    1252         if ( empty( buddypress()->activity->actions->{$activity->component}->{$activity->type}['format_callback'] ) ) {
     1252        $actions = bp_activity_get_actions();
     1253        if ( empty( $actions->{$activity->component}->{$activity->type}['format_callback'] ) ) {
    12531254                return false;
    12541255        }
    12551256
    12561257        // We apply the format_callback as a filter
    1257         add_filter( 'bp_activity_generate_action_string', buddypress()->activity->actions->{$activity->component}->{$activity->type}['format_callback'], 10, 2 );
     1258        add_filter( 'bp_activity_generate_action_string', $actions->{$activity->component}->{$activity->type}['format_callback'], 10, 2 );
    12581259
    12591260        /**
    … …  
    12681269
    12691270        // Remove the filter for future activity items
    1270         remove_filter( 'bp_activity_generate_action_string', buddypress()->activity->actions->{$activity->component}->{$activity->type}['format_callback'], 10, 2 );
     1271        remove_filter( 'bp_activity_generate_action_string', $actions->{$activity->component}->{$activity->type}['format_callback'], 10, 2 );
    12711272
    12721273        return $action;
Note: See TracChangeset for help on using the changeset viewer.