t('Request'), 'send_request' => t('Send Request messages'), 'cancel' => t('Cancel'), 'send_cancel' => t('Send Cancel messages'), 'approve' => t('Approve'), 'send_approve' => t('Send Approve messages'), 'disapprove' => t('Disapprove'), 'send_disapprove' => t('Send Disapprove messages'), 'remove' => t('Remove'), 'send_remove' => t('Send Remove messages'), 'pre_approved' => t('Pre-approved'), 'send_pre_approved' => t('Send Pre-approved messages'), ); } /** * Replacements for mail messages * @param relationship relationship object for which emails are being sent */ function user_relationship_mailer_replacements(&$relationship) { $requester = isset($relationship->requester) ? $relationship->requester : NULL; $requestee = isset($relationship->requestee) ? $relationship->requestee : NULL; //load relationship type, if necessary if (!isset($relationship->relationship_type)) { $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) ? $requester->name : '', '@requester_link' => isset($requester->uid) ? theme('user_relationships_user_link', $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) ? $requestee->name : '', '@requestee_link' => isset($requestee->uid) ? theme('user_relationships_user_link', $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' => $relationship->relationship_type->name, '@relationship_plural_name' => $relationship->relationship_type->plural_name, '@elaboration' => isset($relationship->elaboration) ? $relationship->elaboration : '', ); // #443326 Integration with realname module if (module_exists('realname')) { $replacements['@requester_realname'] = $requester->realname; $replacements['@requestee_realname'] = $requestee->realname; } //'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, ); }