t('Request'), 'send_request' => t('Notify user when a relationship request is made'), 'cancel' => t('Cancel'), 'send_cancel' => t('Notify user when a relationship request is cancelled'), 'approve' => t('Approve'), 'send_approve' => t('Notify requesting user when a relationship request is approved'), 'disapprove' => t('Decline'), 'send_disapprove' => t('Notify requesting user when a relationship request is declined'), 'remove' => t('Delete'), 'send_remove' => t('Notify user when an existing relationship is deleted by another user'), 'pre_approved' => t('Pre-approved'), 'send_pre_approved' => t('Notify user when a relationship request is pre-approved'), ); } /** * Replacements for mail messages * @param relationship relationship object for which emails are being sent */ function user_relationship_mailer_replacements($relationship = NULL) { $requester = isset($relationship->requester) ? $relationship->requester : NULL; $requestee = isset($relationship->requestee) ? $relationship->requestee : NULL; //load relationship type, if necessary if (!isset($relationship->relationship_type) && isset($relationship->rtid)) { $relationship->relationship_type = user_relationships_type_load($relationship->rtid); } $replacements = array( '@site' => variable_get('site_name', 'Drupal'), '@site_url' => $GLOBALS['base_url'], '@requester_name' => isset($requester->name) ? format_username($requester) : '', '@requester_link' => isset($requester->uid) ? theme('user_relationships_user_link', array('uid' => $requester->uid)) : '', '@requester_uid' => isset($requester->uid) ? $requester->uid : '', '@requester_list_link' => isset($requester->uid) ? url("user/{$requester->uid}/relationships/list", array('absolute' => TRUE)) : '', '@requester_pending_link' => isset($requester->uid) ? url("user/{$requester->uid}/relationships/requests", array('absolute' => TRUE)) : '', '@requestee_name' => isset($requestee->name) ? format_username($requestee) : '', '@requestee_link' => isset($requestee->uid) ? theme('user_relationships_user_link', array('uid' => $requestee->uid)) : '', '@requestee_uid' => isset($requestee->uid) ? $requestee->uid : '', '@requestee_list_link' => isset($requestee->uid) ? url("user/{$requestee->uid}/relationships/list", array('absolute' => TRUE)) : '', '@requestee_pending_link' => isset($requestee->uid) ? url("user/{$requestee->uid}/relationships/requests", array('absolute' => TRUE)) : '', '@relationship_name' => isset($relationship->relationship_type) ? $relationship->relationship_type->name : '', '@relationship_plural_name' => isset($relationship->relationship_type) ? $relationship->relationship_type->plural_name : '', '@elaboration' => isset($relationship->elaboration) ? $relationship->elaboration : '', ); //'remove' action needs a few more variables for the template if (isset($relationship->deleted_by)) { $deleted_by = $relationship->deleted_by; $replacements['@deleted_by_name'] = $deleted_by->name; $replacements['@deleted_by_link'] = url("user/{$deleted_by->uid}", array('absolute' => TRUE)); $replacements['@deleted_by_uid'] = $deleted_by->uid; } return $replacements; } /** * Default request relationship message */ function user_relationship_mailer_request_default() { $subject = "[@site] @requester_name wants to be your @relationship_name"; $message = << $subject, 'message' => $message, ); } /** * Default cancel request message */ function user_relationship_mailer_cancel_default() { $subject = "[@site] @requester_name has canceled their @relationship_name request"; $message = << $subject, 'message' => $message, ); } /** * Default approve to relationship message */ function user_relationship_mailer_approve_default() { $subject = "[@site] You are @requestee_name's newest @relationship_name"; $message = << $subject, 'message' => $message, ); } /** * Default disapprove to relationship message */ function user_relationship_mailer_disapprove_default() { $subject = "[@site] @requestee_name has declined your relationship request"; $message = << $subject, 'message' => $message, ); } /** * Default removed relationship message */ function user_relationship_mailer_remove_default() { $subject = "[@site] @relationship_name relationship between @requester_name and @requestee_name has been deleted"; $message = << $subject, 'message' => $message, ); } /** * Default no approval request relationship message */ function user_relationship_mailer_pre_approved_default() { $subject = "[@site] New @relationship_name relationship between @requester_name and @requestee_name"; $message = << $subject, 'message' => $message, ); }