Answers:
对于Drupal 8,您可以运行以下命令:
drush uinf $(drush sqlq "SELECT GROUP_CONCAT(name) FROM users_field_data")
输出将产生类似于以下内容的信息:
User ID : 1
User name : admin
User mail : info@example.com
User roles : authenticated
administrator
User status : 1
对于Drupal 8,在Packagist上有一个Drush 9命令,例如
drush users:list
以表格格式列出所有Drupal用户。请参阅
drush users:list --help
以获取过滤选项。
抱歉...为具有别名的Drupal 8远程计算机编写了此脚本;必要时很容易适应本地。
if [ $# -lt 1 ]
then
echo "Usage : $0 sitealias [all/disabled/enabled] [rolename]"
echo "Note: this only runs on Drupal 8 schema"
exit
fi
ARG1=$1
ARG2=${2:-all}
ARG3=${3:-nothing}
if [ "$ARG3" != "nothing" ]
then
ROLEWHERE='AND user__roles.roles_target_id="'$ARG3'"'
fi
case "$ARG2" in
enabled)
WHERECLAUSE='WHERE users_field_data.status="1" '$ROLEWHERE
;;
disabled)
WHERECLAUSE='WHERE users_field_data.status="0" '$ROLEWHERE
;;
all)
WHERECLAUSE='WHERE users_field_data.status LIKE "%" '$ROLEWHERE
;;
*)
WHERECLAUSE=''
;;
esac
QUERY='SELECT users_field_data.uid,users_field_data.name,users_field_data.mail,from_unixtime(users_field_data.login) AS "lastlogin",user__roles.roles_target_id,users_field_data.status FROM users_field_data LEFT JOIN user__roles ON users_field_data.uid = user__roles.entity_id '$WHERECLAUSE
drush $1 sqlq "$QUERY"