I'll take a look.
Code:
$query = "UPDATE #__comprofiler_members SET accepted='1', pending='0' WHERE referenceid = '$awkeyuserid_item[$aw_i]' AND memberid = '$user->id'";
$query = "UPDATE #__comprofiler_members SET accepted='1', pending='0' WHERE referenceid = '$user->id' AND memberid = '$awkeyuserid_item[$aw_i]'";
$db->setQuery($query);
$db->query();
after the connection is made in the auto welcome plugin.