add purl to function addpids in tools.php