uo_show_support_link_groups
Filters whether to display support link groups, allowing modification of the default display behavior.
add_filter( 'uo_show_support_link_groups', $callback, 10, 1 );
Description
This filter hook controls whether the "Can't find the answer?" support link is displayed in the Uncanny Codes Knowledge Base admin section. Developers can return `false` to hide the link, for example, if they are providing their own support solution. It fires before the link's visibility is determined.
Usage
add_filter( 'uo_show_support_link_groups', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Conditionally hide the "I can't find the answer" support link.
*
* This example demonstrates how to use the 'uo_show_support_link_groups'
* filter to control the visibility of a specific support link within
* the UncannyCodes admin interface.
*
* In a real-world scenario, you might hide this link if the user is
* on a specific plan, or if certain conditions are met that make
* offering immediate direct support unnecessary or undesirable.
*
* @param bool $show_link The current value determining if the link should be shown.
* @return bool Whether the support link should be displayed.
*/
add_filter( 'uo_show_support_link_groups', 'my_custom_hide_support_link', 10, 1 );
function my_custom_hide_support_link( $show_link ) {
// Assume we have a function to check the user's current subscription level.
// Replace 'get_user_subscription_level()' with your actual function.
$user_subscription_level = get_user_subscription_level();
// If the user is on a "free" or "basic" plan, we might want to hide
// the direct support link and instead guide them to the knowledge base.
if ( 'free' === $user_subscription_level || 'basic' === $user_subscription_level ) {
return false; // Hide the support link.
}
// Otherwise, return the original value (which is usually true by default).
return $show_link;
}
// --- Mock function for demonstration purposes ---
// In a real WordPress plugin, this function would likely exist elsewhere.
function get_user_subscription_level() {
// This is a placeholder. In a real plugin, you'd fetch this from
// user meta, an option, or another system.
// For this example, let's randomly return 'free' or 'premium' to simulate different scenarios.
return ( rand( 0, 100 ) % 2 === 0 ) ? 'premium' : 'free';
}
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/admin-kb-articles.php:40
}
}
}
?>
</div>
<?php $show_support_link = apply_filters( 'uo_show_support_link_groups', true ); ?>
<?php if ( $license_is_active && $show_support_link ): ?>
<a href="<?php echo menu_page_url( 'uncanny-groups-kb', false ) . '&send-ticket=true'; ?>">
<?php _e( "I can't find the answer to my question.", 'uncanny-learndash-groups' ); ?>
</a>
<?php endif; ?>