Filter tin-canny-learndash-reporting

uo_show_support_link_tincanny

Filters whether to display the Tincanny support link, defaulting to true.

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

Description

Filters whether the "I can't find the answer" support link is displayed in the Uncanny Toolkit admin KB. Allows developers to conditionally hide this link by returning false. This hook fires within the admin KB article template before the link is rendered.


Usage

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

Return Value

The filtered value.


Examples

/**
 * Conditionally hide the "I can't find the answer" support link based on user role.
 *
 * This filter allows administrators to hide the support link for users who are
 * not administrators, potentially to streamline the user experience or reduce
 * unnecessary support requests.
 *
 * @param bool $show_support_link Whether to show the support link. Defaults to true.
 * @return bool                  The modified value indicating whether to show the support link.
 */
add_filter( 'uo_show_support_link_tincanny', 'my_uncanny_hide_support_link_for_non_admins', 10, 1 );
function my_uncanny_hide_support_link_for_non_admins( $show_support_link ) {
    // If the current user is not an administrator, hide the support link.
    if ( ! current_user_can( 'manage_options' ) ) {
        return false;
    }

    // Otherwise, keep the default behavior.
    return $show_support_link;
}

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/templates/admin-kb-articles.php:41

}
			}

			?>
		</div>

		<?php
		$show_support_link = apply_filters( 'uo_show_support_link_tincanny', true );
		if ( $license_is_active && $show_support_link) {

			?>

			<a href="<?php echo menu_page_url( 'uncanny-tincanny-kb', false ) . '&send-ticket=true'; ?>">
				<?php _e( "I can't find the answer to my question.", 'uncanny-learndash-reporting' ); ?>
			</a>

Scroll to Top