Noindex subscriber author page

The function you want is get_userdata(). Since you need to do this outside the loop, the process is a little less straight-forward.

The first thing you need to do is set up a variable called $curauth which is an object that you create by accessing the database by using the $_GET[] superglobal.

$curauth = ( isset( $_GET[ 'author_name' ] ) ) ? get_user_by( 'slug', $author_name ) : get_userdata( intval ($author ) );

This assigning of $curauth must be in your author.php file.

After that, we can then use the get_userdata() function and feed it the ID from $curauth.

$auth_data = get_userdata( $curauth->ID );

And from there your conditional becomes:

if ( in_array( 'subscriber', $auth_data->roles ) ) {
    // No Follow Code
} else {
    // Follow Code
}

My advice would be to make this all a function in your functions.php file:

function author_nofollow( $author ) {

    $auth_id = $author->ID;
    $auth_data = get_userdata( $auth_id );

    if ( in_array( 'subscriber', $auth_data->roles ) ) {
        echo 'noindex, nofollow';
    } else {
        echo 'index, follow';
    }
}

Then you would just call it like this:

<meta name="robots" content="<?php author_nofollow( $curauth ); ?>">