Q:

Trouble creating custom sanitization function for user list dropdown

I'm trying to create a custom author info box on homepage which will automaically generate by getting the info from user profile when a user is selected from theme customizer. 
I followed the code for user list dropdown in this article and it worked perfectly for me. but I don't know how to sanitize it.
Github Link for Custom_User_Dropdown_control
The following is the example of code I used.
/* custom user dropdown control */
$wp_customize->add_setting( 'custom_user_id', array(
    'default'           => '',
    'sanitize_callback'     => 'custom_sanitize_user_id',
));
$wp_customize->add_control( new Custom_User_Dropdown_Control( $wp_customize, 'custom_user_id', array(
    'label'             => __( 'Select Author', 'text domain' ),
    'section'           => 'custom_author_info',
    'settings'          => 'custom_user_id',
)));

I Just want to sanitize the custom user list dropdown control. 
I know how to sanitize a normal select list, but for this I have no Idea how to do it. The following is the example of code which I use for sanitizing normal select list.
function example_sanitize_code( $input ) {
    $valid = array(
        'option1' => 'option1',
        'option2' => 'option2',
        'option3' => 'option3',
    );

    if ( array_key_exists( $input, $valid ) ) {
       return $input;
    } else {
       return '';
    }
}

Can anyone help? :)

A:

If you want to validate the data then you'll have to try retrieve user via ID.
To only sanitize ID since it's numeric is enough to cast it as integer, absint() will work fine as a callback.

