OK got it king by doing the following
Trigger = onAfterUserRegistration
Position = FIRST (in auto actions ordering)
Params: Reload User = Yes / Format Sunctions = yes
Conditions: [var1_cb_resume] is not empty (make sure something was uploaded!)
Code: Notice I'm using var_ before all field names EXCEPT userid which I assume is only just being assigned at this point so can;t use new value?
Anyway this is now working for me and user passwords are again being stored encrypted!
Code:
jimport('joomla.filesystem.folder');
$basePath = JPATH_SITE . '/images/comprofiler/plug_cbfilefield/[user_id]';
$oldPath = $basePath . '/[var1_cb_resume]';
$fileExt = JFile::getExt('[var1_cb_resume]');
$newFilename = '[cb:parse function="clean" method="string"][var1_firstname][/cb:parse]_[cb:parse function="clean" method="string"][var1_lastname][/cb:parse]_[user_id].'.$fileExt;
if ( file_exists( $oldPath ) ) {
@rename( $oldPath, $basePath . '/' . $newFilename );
$user->set( 'cb_resume', $newFilename );
$user->store();
}