send privatemsg link with Views custom field (Used user_relationships)

Paste the code below in views custom field:

<?php

$profile = content_profile_load('profile', $data->users_user_relationships_uid); // get the id of user whom you want to send a message

$url = privatemsg_get_link(array(user_load($profile->uid)));

print '

'. l(t('Send a private message to the author'), $url, array('attributes' => array('class' => 'lichnoe'))) .'

';

?>