Redirect Logged in Users to Specific Page

Member is using the current existing redirection code:

add_action('wp_head','wpmy_redirect_logged_in_users_away_from_home');
function wpmy_redirect_logged_in_users_away_from_home() {
if( is_user_logged_in() && ( is_home() || is_front_page() ) ) {
$current_user = wp_get_current_user();
$role_name = $current_user->roles[0];
switch ($role_name) {
case "subscriber":
wp_redirect('https://xxxx/cuenta-gratis-1/');
break;
case "contributor":
wp_redirect('https://xxx/mi-escritorio-7-dias/');
break;
}
}
}

Needs to redirect logged in user when the login page is loaded, login page id 4097