Changeset 8192
- Timestamp:
- 03/28/2014 11:14:15 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-admin.php
r8085 r8192 459 459 // Activity type 460 460 if ( ! empty( $_POST['bp-activities-type'] ) ) { 461 $actions = array(); 462 463 // Walk through the registered actions, and build an array of actions/values. 464 foreach ( $bp->activity->actions as $action ) { 465 $action = array_values( (array) $action ); 466 467 for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ ) 468 $actions[] = $action[$i]['key']; 461 $actions = bp_activity_admin_get_activity_actions(); 462 463 // Check that the new type is a registered activity type 464 if ( in_array( $_POST['bp-activities-type'], $actions ) ) { 465 $activity->type = $_POST['bp-activities-type']; 469 466 } 470 471 // This was a mis-named activity type from before BP 1.6472 unset( $actions['friends_register_activity_action'] );473 474 // Check that the new type is a registered activity type475 if ( in_array( $_POST['bp-activities-type'], $actions ) )476 $activity->type = $_POST['bp-activities-type'];477 467 } 478 468 … … 737 727 738 728 /** 729 * Get flattened array of all registered activity actions. 730 * 731 * Format is [activity_type] => Pretty name for activity type. 732 * 733 * @since BuddyPress (2.0.0) 734 * 735 * @return array 736 */ 737 function bp_activity_admin_get_activity_actions() { 738 $actions = array(); 739 740 // Walk through the registered actions, and build an array of actions/values. 741 foreach ( buddypress()->activity->actions as $action ) { 742 $action = array_values( (array) $action ); 743 744 for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ ) { 745 $actions[ $action[$i]['key'] ] = $action[$i]['value']; 746 } 747 } 748 749 // This was a mis-named activity type from before BP 1.6 750 unset( $actions['friends_register_activity_action'] ); 751 752 // Sort array by the human-readable value 753 natsort( $actions ); 754 755 return $actions; 756 } 757 758 /** 739 759 * Activity type metabox for the Activity admin edit screen 740 760 *
Note: See TracChangeset
for help on using the changeset viewer.