Filter tin-canny-learndash-reporting

uo_tincan_ld_admin_capability_check

Filters the capability required to access LearnDash admin settings within the Uncanny Owl Tin Can API integration.

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

Description

Fires when checking if a user has admin capabilities for Tin Can API features. Developers can filter the required capability from the default 'manage_options' to customize access control for specific user roles within LearnDash integrations.


Usage

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

Return Value

The filtered value.


Examples

/**
 * Example of modifying the capability required to be considered an admin for the Tincan LD integration.
 * By default, it checks for 'manage_options'. This example changes it to 'edit_others_posts'.
 *
 * @param string $capability The capability to check for.
 * @return string The modified capability.
 */
add_filter( 'uo_tincan_ld_admin_capability_check', 'my_custom_tincan_ld_admin_capability', 10, 1 );

function my_custom_tincan_ld_admin_capability( $capability ) {
    // Change the default 'manage_options' capability to 'edit_others_posts'
    // This means users who can edit posts from other users will be considered admins
    // for the Tincan LD integration.
    $modified_capability = 'edit_others_posts';

    return $modified_capability;
}

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/init.php:296
src/init.php:305

function uotc_is_user_admin( $user_id ) {
	return user_can( $user_id, apply_filters( 'uo_tincan_ld_admin_capability_check', 'manage_options' ) );
}

Scroll to Top