| | 845 | /** |
| | 846 | * Returns the list of available BuddyPress activity types. |
| | 847 | * |
| | 848 | * @since 9.0.0 |
| | 849 | * |
| | 850 | * @return array An array of activity type labels keyed by type names. |
| | 851 | */ |
| | 852 | function bp_activity_get_types_list() { |
| | 853 | $actions_object = bp_activity_get_actions(); |
| | 854 | $actions_array = get_object_vars( $actions_object ); |
| | 855 | |
| | 856 | $types = array(); |
| | 857 | foreach ( $actions_array as $component => $actions ) { |
| | 858 | $new_types = wp_list_pluck( $actions, 'label', 'key' ); |
| | 859 | |
| | 860 | if ( $types ) { |
| | 861 | // Makes sure activity types are unique. |
| | 862 | $new_types = array_diff_key( $new_types, $types ); |
| | 863 | |
| | 864 | if ( 'friends' === $component ) { |
| | 865 | $new_types = array_diff_key( |
| | 866 | array( |
| | 867 | 'friendship_accepted' => false, |
| | 868 | 'friendship_created' => false, |
| | 869 | 'friends_register_activity_action' => false, |
| | 870 | ), |
| | 871 | $new_types |
| | 872 | ); |
| | 873 | |
| | 874 | $new_types['friendship_accepted,friendship_created'] = __( 'Friendships', 'buddypress' ); |
| | 875 | } |
| | 876 | } |
| | 877 | |
| | 878 | $types = array_merge( $types, $new_types ); |
| | 879 | } |
| | 880 | |
| | 881 | /** |
| | 882 | * Filter here to edit the activity types list. |
| | 883 | * |
| | 884 | * @since 9.0.0 |
| | 885 | * |
| | 886 | * @param array $types An array of activity type labels keyed by type names. |
| | 887 | */ |
| | 888 | return apply_filters( 'bp_activity_get_types_list', $types ); |
| | 889 | } |
| | 890 | |