I should have mentioned this earlier: one other thing you might try is dumping the $scriptProperties array to see where the username is. MODX often pulls the $_POST stuff into $scriptProperties early in a process and ignores the $_POST array from that point on. The $scriptProperties array gets passed along during the process and changing the username there might work.
Here's how I do it (and this technique is often useful for debugging plugins):
Create a chunk called debug.
In your plugin code:
<?php
$msg = print_r($scriptProperties, true);
$chunk = $modx->getObject('modChunk', array('name' => 'debug'));
$chunk->setContent($msg);
$chunk->save();
It may take a little time because the $scriptProperties array is often monstrous and the username may appear in various places. If there's a 'data' member, that's the best bet.
And be careful, because in theory, you could corrupt your DB by changing the $scriptProperties array during a process that writes to the DB (though it's never happened to me, Login won't normally be writing anything, and just changing the username should be safe enough).
I actually put the code above in a function called myDebug() wrapped in if(function_exists), with the option to write or append to the debug chunk.
After examining the dump, you can often dump just part of the $scriptProperties array, e.g.,
print_r($scriptProperties['data'], true);
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
[ed. note: BobRay last edited this post 14 years, 1 month ago.]