How to remove Log in ,Create new account and Reset your password local tasks in login form.
You can remove Create new account local task by allow only Administrators to create accounts, so just go to Configuration > Account settings > REGISTRATION AND CANCELLATION and check Administrators only like this:
But the other two local tasks Log in and Reset your password there is no way to hide or remove them from the UI, the only way is to use hook_menu_local_tasks_alter :
<?php
/**
* Implements hook_menu_local_tasks_alter().
*/
function YOURMODULE_menu_local_tasks_alter(&$data, $route_name) {
if($route_name == 'user.login' && isset($data['tabs'][0])) {
// Remove all tabs from user login form.
foreach ($data['tabs'][0] as $key => $tab){
$data['tabs'][0][$key]['#access'] = FALSE;
}
}
}
Clear cache and you are done!
Comments