Well, I have a vb3 test site, but I haven't actually tried this code. But now I see that I've misled you again with another mistake. The last line should be:
Code:
$vbulletin->GPC['userfield']['field1'] = str_replace($fieldcontentbefore, $fieldcontentafter, $vbulletin->GPC['userfield']['field1']);
ETA: ...and that seems to work for me. I used 'field4' (Occupation) and when I edited my details and put in "aaa" it was set to "bbb".
Also, that will obviously only work if the entire sting matches. If you want substrings, I think this should work:
Code:
if ($_POST['do'] == 'updateprofile')
{
$vbulletin->input->clean_gpc('p', 'userfield', TYPE_ARRAY);
$fieldcontentbefore = array(
'/aaa/',
'/ccc/'
);
$fieldcontentafter = array(
'bbb',
'ddd'
);
$vbulletin->GPC['userfield']['field1'] = preg_replace($fieldcontentbefore, $fieldcontentafter, preg_quote($vbulletin->GPC['userfield']['field1'], '/'));
}
Note the before array needs '/' before and after the string to be matched.