我不知道是否有任何插件允许这样做,但如果您不介意使用一些SQL,可以通过以下方式提取:
SELECT u.ID, u.user_login, u.user_email, u.user_registered, u.display_name, b.path
FROM wp_users u
LEFT JOIN wp_usermeta um ON um.user_id = u.ID
LEFT JOIN wp_blogs b ON um.meta_key LIKE CONCAT_WS(\'_\', \'wp\', b.blog_id, \'capabilities\')
WHERE um.meta_value LIKE \'%"administrator"%\' OR um.meta_value LIKE \'%"editor"%\';
这将生成以下结果集:
+----+------------+---------------------+---------------------+--------------+----------------+
| ID | user_login | user_email | user_registered | display_name | path |
+----+------------+---------------------+---------------------+--------------+----------------+
| 1 | jdoe | [email protected] | 2014-12-02 10:46:26 | John Doe | /subsite-path/ |
+----+------------+---------------------+---------------------+--------------+----------------+
其中,ID、user\\u login、user\\u email、user\\u registered和display\\u name是用户的详细信息,而path是子网站URL(如果您的网络安装是基于域而不是基于目录的,则可能需要选择域而不是路径)
请注意,这将为注册用户的每个站点生成一行,这意味着如果您在一个站点上注册了一个管理员,在另一个站点上注册了一个编辑器,则查询将为此用户生成两行。
使用GROUP\\u CONCAT,您可以将所有这些行连接为一行:
SELECT u.ID, u.user_login, u.user_email, u.user_registered, u.display_name, GROUP_CONCAT(b.path ORDER BY b.path SEPARATOR \'\\n\')
FROM wp_users u
LEFT JOIN wp_usermeta um ON um.user_id = u.ID
LEFT JOIN wp_blogs b ON um.meta_key LIKE CONCAT_WS(\'_\', \'wp\', b.blog_id, \'capabilities\')
WHERE um.meta_value LIKE \'%"administrator"%\' OR um.meta_value LIKE \'%"editor"%\'
GROUP BY u.ID;
这将生成以下结果集:
+----+------------+---------------------+---------------------+--------------+-----------------+
| ID | user_login | user_email | user_registered | display_name | path |
+----+------------+---------------------+---------------------+--------------+-----------------+
| 1 | jdoe | [email protected] | 2014-12-02 10:46:26 | John Doe | /subsite1-path/ |
| | | | | | /subsite2-path/ |
+----+------------+---------------------+---------------------+--------------+-----------------+