Skip to:
Content

BuddyPress.org

Changeset 8085


Ignore:
Timestamp:
03/08/2014 08:05:32 PM (10 years ago)
Author:
boonebgorges
Message:

Better fallback support on Activity Admin for items with an unregistered type

The 'Type' dropdown on the activity edit screen is populated with types that
have been registered with bp_activity_set_action(). However, many legacy
plugins do not register their activity types correctly. This adds support
for editing these types of activity items.

Fixes #4786

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-admin.php

    r8030 r8085  
    763763
    764764    // Sort array by the human-readable value
    765     natsort( $actions ); ?>
     765    natsort( $actions );
     766
     767    // If the activity type is not registered properly (eg, a plugin has
     768    // not called bp_activity_set_action()), add the raw type to the end
     769    // of the list
     770    if ( ! isset( $actions[ $selected ] ) ) {
     771        _doing_it_wrong( __FUNCTION__, sprintf( __( 'This activity item has a type (%s) that is not registered using bp_activity_set_action(), so no label is available.', 'buddypress' ), $selected ), '2.0.0' );
     772        $actions[ $selected ] = $selected;
     773    }
     774
     775    ?>
    766776
    767777    <select name="bp-activities-type">
Note: See TracChangeset for help on using the changeset viewer.