我无法发表评论,但Wraezor Sharp的回应对我来说非常有效。我需要用户电子邮件地址,我们的多站点实例都在同一个域名上,我只需要管理员,不需要订阅者。这就是我想到的:
SELECT
u.user_login
, u.user_email
, concat(\'https://\', b.domain, b.path) as site
, SUBSTRING_INDEX(SUBSTRING_INDEX(um.meta_value,\'"\', 2), \'"\', -1) as role
FROM
wp_users u
JOIN wp_usermeta um ON u.ID = um.user_id
JOIN wp_blogs b ON b.blog_id = SUBSTRING(um.meta_key, 4, LENGTH(um.meta_key)-16)
WHERE
um.meta_key LIKE \'wp_%_capabilities\'
AND SUBSTRING_INDEX(SUBSTRING_INDEX(um.meta_value,\'"\', 2), \'"\', -1) IN (\'administrator\', \'editor\')
ORDER BY
site asc
;