I’m not suprised really...
Here you are setting the $output variable to the result of the first replacement.
$output = str_replace(’[+name+]’, $prDbProfile[’members_display_name’], $prChunk);
And now you are setting the same variable again (throwing away the old value) with the result of the second replacement and what’s more,.. starting from a fresh $prChunk which hasn’t changed and still contains both placeholders, so only [+lastvisit+] is replaced. The other placeholder is cleaned up by modx at some stage.
$output = str_replace(’[+lastvisit+]’, $prDbProfileDate, $prChunk);
Try again...
$output = str_replace(’[+name+]’, $prDbProfile[’members_display_name’], $prChunk);
$output = str_replace(’[+lastvisit+]’, $prDbProfileDate, $output);
Here it’s using the $output variable as the source of the of the second replacement. Should make you much happier.
Of course you could also let MODx deal with the placeholders:
<?php
// IF NO ERRORS HAS OCCURED
if (empty($prError)) {
// FETCH THE PROFILE DATA AND FIX THE DATE FORMAT
$prDbProfileDate = date('l dS F Y h:i:s A',$prDbProfile['last_visit']);
//SET PLACEHOLDERS
$modx->setPlaceholder('name', $prDbProfile['members_display_name']);
$modx->setPlaceholder('lastvisit', $prDbProfileDate);
// RETURN THE CHUNK
return $modx->getChunk('profil-test');
}
?>
Edit: Oops,... cross-posted with heliotrope

I agree, parseChunk() is even simpler. Have a look at the
wiki