Hi,

For our site we thought it would be useful for users to be able to send nodes to members of their buddylist as well as email addresses. Here is the code I added at Line 422 to accomplish this:

$buddies = @buddylist_get_buddies($GLOBALS['user']->uid);

foreach ($recipient_addresses as $address) {
	if ((user_validate_mail($address)) && ($address != '')) {
		if($buddies) {
			$match = false;
			foreach($buddies as $item => $value) {
				if(strtolower($value['name']) == strtolower($address)) {
					$address = $value['mail'];
					$match = true;
					break;
				}
			}
			if (!$match) {
				form_set_error('recipients', t('One of your Recipient addresses is invalid:') .'<br />'. $address);
			}
		}
	}
}

I'm sure it can be cleaned up, but that's the first draft anyway.

Comments

bsonnich’s picture

Sorry, that's not a complete solution. I had to do a bit more tweaking to get it fixed up. The key was in making $recipient_addresses a global variable so that it could be used in the send function rather than the $recipients variable.

john.oltman’s picture

Status: Active » Closed (duplicate)