Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/20/2015 06:50:52 PM (7 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.