Exporting user email information from Discuz!

I wanted to export users' email addresses today, but I couldn't get it to work no matter what I tried. Discuz's filtering function is indeed very powerful, but it just can't export emails. Maybe emails aren't valued much in China. I did some research myself and am sharing it with you:

1. Open source\class\table\table_common_member.php, and add this function after fetch_all_username_by_uid to retrieve emails.

public function fetch_all_useremail_by_uid($uids) { $users = array(); if(($uids = dintval($uids, true))) { foreach($this->fetch_all($uids) as $uid => $value) { $users[$uid] = $value['email']; } } return $users; }

2. Locate source\admincp\admincp_members.php, query elseif($operation == ‘export’) {, and make the following modifications:

discuz导出用户邮箱email信息 - WX20170330 172229@2x - Jake blog

The code is pasted here:

$alluseremail = C::t('common_member')->fetch_all_useremail_by_uid($uids); $profile = array_merge(array('uid'=>$uid, 'email'=>$alluseremail[$uid], 'username'=>$allusername[$uid]),$profile); $detail = 'UID,'.'Email,'.$lang['username'].','.$subject.'\n'.$detail;

This siteOriginal articleAll follow "Attribution-NonCommercial-ShareAlike 4.0 License (CC BY-NC-SA 4.0)Please retain the following annotations when sharing or adapting:

Original author:Jake Tao,source:Exporting user email information using Discuz!

162
0 0 162

Further Reading

Post a reply

Log inYou can only comment after that.
Share this page
Back to top