i've seeing the files and i made this:
	PHP Code:
	
		
			
function items_milagros($item, $adopt){
$codigopromo = $adopts->select("items_functions", array(), "code")->fetchObject();
$mtitle = "Has ganado un logro!";
        $mtext = "Felicitaciones!  Has recibido una recompenza. El código es el siguiente:{$codigopromo} . Puedes usarlo en la página de promos. Para saber como usarlo hay una gu*a correspondiente.";
        $date = date('Y-m-d');
        $GLOBALS['adopts']->insert("messages", array("id" => NULL, "fromuser" => "SYSTEM", "touser" => $owner, "status" => "unread", "datesent" => $date, "messagetitle" => $mtitle, "messagetext" => $mtext));
        
        $row = $GLOBALS['adopts']->select("users", array(), "username='{$owner}'")->fetchObject();    
        $newmessagenotify=$row->newmessagenotify;
        $email=$row->email;
        
        if($newmessagenotify == 1) {
            // We are sending this user an email about the new message...
            $systememail = grabanysetting("systememail"); // QUERYPROBLEM - we should get the settings at the beginning so we never need to call for them after that.            
            $headers = "From: {$systememail}";
            $site_name = grabanysetting("sitename"); // QUERYPROBLEM - see, two queries for this message alone.
            $message = "Hello {$owner};\n\nYou have received a new Private Message from SYSTEM at {$site_name} with the title {$mtitle}.\n
            You can read this message at: http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/messages.php\n
            Thank You.  The {$site_name} team.";
            mail($email, $site_name." - You Have Received a Reward", $message, $headers);
        }
        
$note = "Has conseguido un código promo!";
return $note;
} 
		
	
 Its a new function. I want that when i use a item with this function, the system send me a pm, giving me a promocode.
But doesn't work. Any idea? when i use the item, the screen goes blank.
Thank you