add_cap('create_users');
});
// allows admins send enrollment mails in user overview
add_filter('user_row_actions', function($actions, $user) {
// TODO: check if created with almefy OR login without almefy disabled
// unset($actions['resetpassword']);
// show "send 2 factor email" button
$actions['almefy_enroll'] = "" . __( 'Reconnect Almefy', 'almefy-me' ) . "";
// show whether almefy is enabled for this user
try {
$identity = Almefy::$client->getIdentity($user->user_email);
$tokens = $identity->getTokens();
// if (count($tokens) > 0) {
$actions['almefy_enabled'] = "" . __( '2-factor devices connected: ', 'almefy-me' ) . count($tokens) . "";
// }
} catch (\Throwable $th) {
//throw $th;
}
return $actions;
}, 10, 2);
// makes sure the "almefy_enroll" action actually sends an email
add_action('admin_footer', function() {
ob_start();
?>