| 1 |
<?php
|
| 2 |
// $Id: temporary_invitation_rules.inc,v 1.3 2007/11/15 21:26:13 jpetso Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Temporary Invitation - Invite guests for a limited timespan.
|
| 6 |
* This file provides support for workflow-ng.
|
| 7 |
*
|
| 8 |
* Copyright 2007 by Jakob Petsovits ("jpetso", http://drupal.org/user/56020)
|
| 9 |
*/
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_entity_into().
|
| 13 |
*/
|
| 14 |
function temporary_invitation_entity_info() {
|
| 15 |
return array(
|
| 16 |
'temporary_invitation' => array(),
|
| 17 |
'temporary_invitation_with_passcode' => array(),
|
| 18 |
'temporary_invitation_mail' => array(),
|
| 19 |
);
|
| 20 |
}
|
| 21 |
|
| 22 |
/**
|
| 23 |
* Implementation of hook_event_info().
|
| 24 |
*/
|
| 25 |
function temporary_invitation_event_info() {
|
| 26 |
return array(
|
| 27 |
'temporary_invitation_insert' => array(
|
| 28 |
'#label' => t('Invited user gets invited by host user.'),
|
| 29 |
'#module' => t('Temporary Invitation'),
|
| 30 |
'#arguments' => array(
|
| 31 |
'invitation' => array(
|
| 32 |
'#entity' => 'temporary_invitation_with_passcode',
|
| 33 |
'#label' => t('invitation properties')
|
| 34 |
),
|
| 35 |
'mail' => array(
|
| 36 |
'#entity' => 'temporary_invitation_mail',
|
| 37 |
'#label' => t('invitation mail')
|
| 38 |
),
|
| 39 |
'invited-user' => array(
|
| 40 |
'#entity' => 'user',
|
| 41 |
'#label' => t('invited user (the user who received the invitation)'),
|
| 42 |
'#handler' => 'temporary_invitation_events_argument_invited_user',
|
| 43 |
),
|
| 44 |
'host-user' => array(
|
| 45 |
'#entity' => 'user',
|
| 46 |
'#label' => t('host user (the user who sent the invitation)'),
|
| 47 |
'#handler' => 'temporary_invitation_get_host_user',
|
| 48 |
),
|
| 49 |
),
|
| 50 |
),
|
| 51 |
'temporary_invitation_login' => array(
|
| 52 |
'#label' => t('A temporarily invited user has logged in using a login code.'),
|
| 53 |
'#module' => t('Temporary Invitation'),
|
| 54 |
'#arguments' => array(
|
| 55 |
'invitation' => array(
|
| 56 |
'#entity' => 'temporary_invitation_with_passcode',
|
| 57 |
'#label' => t('invitation properties.')
|
| 58 |
),
|
| 59 |
'invited-user' => array(
|
| 60 |
'#entity' => 'user',
|
| 61 |
'#label' => t('invited user (the user who received the invitation)'),
|
| 62 |
'#handler' => 'temporary_invitation_events_argument_invited_user',
|
| 63 |
),
|
| 64 |
'host-user' => array(
|
| 65 |
'#entity' => 'user',
|
| 66 |
'#label' => t('host user (the user who sent the invitation)'),
|
| 67 |
'#handler' => 'temporary_invitation_get_host_user',
|
| 68 |
),
|
| 69 |
),
|
| 70 |
),
|
| 71 |
'temporary_invitation_delete' => array(
|
| 72 |
'#label' => t('Invitation has been deleted.'),
|
| 73 |
'#module' => t('Temporary Invitation'),
|
| 74 |
'#arguments' => array(
|
| 75 |
'invitation' => array(
|
| 76 |
'#entity' => 'temporary_invitation',
|
| 77 |
'#label' => t('invitation properties')
|
| 78 |
),
|
| 79 |
'invited-user' => array(
|
| 80 |
'#entity' => 'user',
|
| 81 |
'#label' => t('invited user (the user who received the invitation)'),
|
| 82 |
'#handler' => 'temporary_invitation_events_argument_invited_user',
|
| 83 |
),
|
| 84 |
'host-user' => array(
|
| 85 |
'#entity' => 'user',
|
| 86 |
'#label' => t('host user (the user who sent the invitation)'),
|
| 87 |
'#handler' => 'temporary_invitation_get_host_user',
|
| 88 |
),
|
| 89 |
),
|
| 90 |
),
|
| 91 |
);
|
| 92 |
}
|
| 93 |
|
| 94 |
function temporary_invitation_events_argument_invited_user($invitation) {
|
| 95 |
$invited_user = temporary_invitation_get_invited_user($invitation);
|
| 96 |
|
| 97 |
// Provide the correct mail address for Token replacements,
|
| 98 |
// hoping that the admin doesn't create a "save user" rule.
|
| 99 |
$invited_user->mail = $invited_user->init;
|
| 100 |
return $invited_user;
|
| 101 |
}
|