SeToY
Well-known member
Thank you for that update. The key for the Discord connected account provider remained unchanged, though. I think you missed that?Jaxel updated XF2 [8WR] Discord Integration with a new update entry:

Thank you for that update. The key for the Discord connected account provider remained unchanged, though. I think you missed that?Jaxel updated XF2 [8WR] Discord Integration with a new update entry:
This is a continuation of the 2.1.1.0 update that came out a few hours ago. I HIGHLY recommend you read the patch notes for that update as well:
![]()
XF2 [8WR] Discord Integration - Updates
xenforo.com
This update continues with the normalization and standardization which began in the last update. However, this update is a bit trickier. In this version, the connected account provider has been changed from...
You can, actuallyUnfortunately, we can't just rename connected accounts and call it a day.
public function upgrade2111Step1(array $stepParams)
{
$position = empty($stepParams[0]) ? 0 : $stepParams[0];
$perPage = 250;
$db = $this->db();
if (!isset($stepParams['max']))
{
$stepParams['max'] = $db->fetchOne("
SELECT MAX(user_id)
FROM xf_user_connected_account
WHERE provider = 'discord'
");
}
$userIds = $db->fetchAllColumn($db->limit(
"
SELECT DISTINCT user_id
FROM xf_user_connected_account
WHERE user_id > ?
AND provider = 'discord'
ORDER BY user_id
", $perPage
), $position);
if (!$userIds)
{
return true;
}
$db->beginTransaction();
$repo = \XF::repository('XF:ConnectedAccount');
$connectedAccounts = \XF::finder('XF:UserConnectedAccount')->where('user_id', $userIds)->with(['User'])->fetch();
foreach ($connectedAccounts as $connectedAccount)
{
$connectedAccount->fastUpdate('provider', 'ewr_discord');
$repo->rebuildUserConnectedAccountCache($connectedAccount->User);
}
$db->commit();
$next = end($userIds);
return [
$next,
"{$next} / {$stepParams['max']}",
$stepParams
];
}
Jaxel updated XF2 [8WR] Discord Integration with a new update entry:
Unfortunately, we can't just rename connected accounts and call it a day. ALL users will be required to reconnect their discord accounts to their forum accounts. Previous connected accounts with Discord will be deleted with this upgrade in order to prevent email clashes as well. That's just the way it is. Not much that can be done about it.
Okay, I've replaced the upgrade step with your code.You can, actually
I took the liberty of writing the upgrade method for you:
PHP:public function upgrade2111Step1(array $stepParams) { $position = empty($stepParams[0]) ? 0 : $stepParams[0]; $perPage = 250; $db = $this->db(); if (!isset($stepParams['max'])) { $stepParams['max'] = $db->fetchOne(" SELECT MAX(user_id) FROM xf_user_connected_account WHERE provider = 'discord' "); } $userIds = $db->fetchAllColumn($db->limit( " SELECT DISTINCT user_id FROM xf_user_connected_account WHERE user_id > ? AND provider = 'discord' ORDER BY user_id ", $perPage ), $position); if (!$userIds) { return true; } $db->beginTransaction(); $repo = \XF::repository('XF:ConnectedAccount'); $connectedAccounts = \XF::finder('XF:UserConnectedAccount')->where('user_id', $userIds)->with(['User'])->fetch(); foreach ($connectedAccounts as $connectedAccount) { $connectedAccount->fastUpdate('provider', 'ewr_discord'); $repo->rebuildUserConnectedAccountCache($connectedAccount->User); } $db->commit(); $next = end($userIds); return [ $next, "{$next} / {$stepParams['max']}", $stepParams ]; }
This is untested, but I don't see why it wouldn't work. If it comes down to it, I'll test it on the live site running this add-on as that site certainly cannot afford to lose all associations.
EDIT: Made some tweaks based on further reading of the code
I actually had to make slight tweaks to your code. Your code only worked on forums which only used Discord. If they used facebook, twitter, google, etc as well, it had issues.You can, actually![]()
public function upgrade2111Step1(array $stepParams)
{
$position = empty($stepParams[0]) ? 0 : $stepParams[0];
$perPage = 250;
$db = $this->db();
if (!isset($stepParams['max']))
{
$stepParams['max'] = $db->fetchOne("
SELECT MAX(user_id)
FROM xf_user_connected_account
WHERE provider = 'discord'
");
}
$userIds = $db->fetchAllColumn($db->limit("
SELECT DISTINCT user_id
FROM xf_user_connected_account
WHERE user_id > ?
AND provider = 'discord'
ORDER BY user_id
", $perPage
), $position);
if (!$userIds) { return true; }
$db->beginTransaction();
$connectedAccounts = \XF::finder('XF:UserConnectedAccount')->where([
['user_id', $userIds],
['provider', 'discord']
])->with(['User'])->fetch();
$repo = \XF::repository('XF:ConnectedAccount');
foreach ($connectedAccounts as $connectedAccount)
{
$connectedAccount->fastUpdate('provider', 'ewr_discord');
$repo->rebuildUserConnectedAccountCache($connectedAccount->User);
}
$db->commit();
$next = end($userIds);
return [$next, "{$next} / {$stepParams['max']}", $stepParams];
}
Do you plan to also fix it so it won't delete our member accounts?
That's what the current 2.1.1.1 does. Download the most recent version.Do you plan to also fix it so it won't delete our member accounts?
We can't really upgrade while there's a risk that member accounts will be deleted by the upgrade.
I used the update link you emailed us.That's what the current 2.1.1.1 does. Download the most recent version.
ErrorException: [E_WARNING] Invalid argument supplied for foreach() in src/addons/EWR/Discord/Repository/Log.php at line 36
XF::handlePhpError() in src/addons/EWR/Discord/Repository/Log.php at line 36
EWR\Discord\Repository\Log->groupLogs() in src/addons/EWR/Discord/Admin/Controller/Log.php at line 50
EWR\Discord\Admin\Controller\Log->actionDiscord() in src/XF/Mvc/Dispatcher.php at line 350
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2184
XF\App->run() in src/XF.php at line 391
XF::runApp() in admin.php at line 13
I just rebuilt the addon and have the same exact issue.Did you guys run the upgrade script? It should be looking forcon_acc.ewr_discord
, notcon_acc.discord
. Try rebuilding the addon.
Fixed an error with the upgrade script in the last version.
- Fixed direct messaging for private message conversations.
Thanks for the super quick response!Jaxel updated XF2 [8WR] Discord Integration with a new update entry:
2.1.1.3 - CHANGELOG
Read the rest of this update entry...
We use essential cookies to make this site work, and optional cookies to enhance your experience.