Filter uncanny-automator

automator_microsoft_teams_channel_types

Filters the available Microsoft Teams channel types for use in automation actions.

add_filter( 'automator_microsoft_teams_channel_types', $callback, 10, 1 );

Description

Filters the available Microsoft Teams channel types. Developers can modify this array to add, remove, or alter the displayed channel types for use within Uncanny Automator's Microsoft Teams integration. This hook fires before the channel types are formatted as options.


Usage

add_filter( 'automator_microsoft_teams_channel_types', 'your_function_name', 10, 1 );

Parameters

$channel_types (mixed)
This parameter contains an array of available Microsoft Teams channel types that can be filtered by the hook.

Return Value

The filtered value.


Examples

<?php
/**
 * Example of how to filter the available Microsoft Teams channel types.
 *
 * This function demonstrates how to add a new channel type or modify existing ones
 * when interacting with Microsoft Teams through Uncanny Automator.
 *
 * @param array $channel_types An array of channel types with their display names.
 * @return array The modified array of channel types.
 */
function my_custom_microsoft_teams_channel_types( $channel_types ) {
    // Add a new channel type for demonstration purposes.
    // In a real-world scenario, you might have logic to dynamically
    // determine available channel types based on specific user roles or configurations.
    $channel_types['org-wide'] = esc_html__( 'Organization-Wide', 'my-text-domain' );

    // You could also remove existing ones if needed:
    // unset( $channel_types['private'] );

    // Or modify existing ones:
    // $channel_types['standard'] = esc_html__( 'General Channel', 'my-text-domain' );

    return $channel_types;
}
add_filter( 'automator_microsoft_teams_channel_types', 'my_custom_microsoft_teams_channel_types', 10, 1 );
?>

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/integrations/microsoft-teams/actions/microsoft-teams-create-channel.php:162

private function get_channel_type_options() {

		$channel_types = array(
			'standard' => esc_html_x( 'Standard', 'Microsoft Teams', 'uncanny-automator' ),
			'private'  => esc_html_x( 'Private', 'Microsoft Teams', 'uncanny-automator' ),
			'shared'   => esc_html_x( 'Shared', 'Microsoft Teams', 'uncanny-automator' ),
		);

		$channel_types = apply_filters( 'automator_microsoft_teams_channel_types', $channel_types );

		return automator_array_as_options( $channel_types );
	}

Scroll to Top