/[drupal]/contributions/modules/node_invite/node_invite.send.inc
ViewVC logotype

Diff of /contributions/modules/node_invite/node_invite.send.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4.2.2, Wed Sep 2 05:43:38 2009 UTC revision 1.4.2.3, Thu Sep 3 00:17:30 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: node_invite.send.inc,v 1.4.2.1 2009/09/02 00:56:32 hadsie Exp $  // $Id: node_invite.send.inc,v 1.4.2.2 2009/09/02 05:43:38 hadsie Exp $
3  /**  /**
4   * @file   * @file
5   * Provides the invite sending form.   * Provides the invite sending form.
# Line 125  function node_invite_send_submit($form, Line 125  function node_invite_send_submit($form,
125        }        }
126        watchdog('node_invite', 'TO: ' . check_plain($email));        watchdog('node_invite', 'TO: ' . check_plain($email));
127    
128        // 3. store a record in {node_invites} and get insrt_id (which we use to build the message)        // 3. store a record in {node_invites} and get insert_id
129        db_query("INSERT INTO {node_invites} (nid, email_invitee, uid_inviter, status, sent) VALUES (%d, '%s', %d, '%s', %d)", $node->nid, $email, $user->uid, 'NEW', time());        // (which we use to build the message)
130          $sent = time();
131          $hash = md5($email . $sent);
132          db_query("INSERT INTO {node_invites} (nid, email_invitee, uid_inviter, status, sent, hash) VALUES (%d, '%s', %d, '%s', %d, '%s')", $node->nid, $email, $user->uid, 'NEW', $sent, $hash);
133        $insert_id = db_last_insert_id('node_invites', 'iid');        $insert_id = db_last_insert_id('node_invites', 'iid');
134    
135        // 3.5 we need to send the invite stuff to token_replace (so it can drp in names, etc.        // 3.5 we need to send the invite stuff to token_replace (so it can drp in names, etc.
136        // this also over-rides the old (and right) way of doing this where we pulled inviter-name/mail from global $user        // this also over-rides the old (and right) way of doing this where we pulled inviter-name/mail from global $user
137        $node->invite_specific_info = array(        $node->invite_specific_info = array(
138          'node-invite-iid' => $insert_id,          'node-invite-iid' => $insert_id,
139            'node-invite-hash' => $hash,
140          'node-invite-recip-name' => $recip_name,          'node-invite-recip-name' => $recip_name,
141          'node-invite-recip-mail' => $recip_mail,          'node-invite-recip-mail' => $recip_mail,
142          'inviter-name' => $form_state['values']['your_name'],          'inviter-name' => $form_state['values']['your_name'],
# Line 140  function node_invite_send_submit($form, Line 144  function node_invite_send_submit($form,
144        );        );
145    
146        // 4. build the email message for this user (link is different for every specific message... which is slow (re-parse every single message)        // 4. build the email message for this user (link is different for every specific message... which is slow (re-parse every single message)
147        $inviter_rsvp_url = url('node_invite/rsvp/' . $node->nid . '/' . $insert_id, array('absolute' => TRUE));        $inviter_rsvp_url = url(node_invite_rsvp_path($insert_id), array('absolute' => TRUE));
148    
149        $new_default_message = str_replace("[inviter-rsvp-url]", $inviter_rsvp_url, $default_message);        $new_default_message = str_replace("[inviter-rsvp-url]", $inviter_rsvp_url, $default_message);
150        $replaced_message = token_replace($new_default_message, 'node', $node);        $replaced_message = token_replace($new_default_message, 'node', $node);
151        $replaced_message .= "\n<br />" . token_replace($form_state['values']['personal_message'], 'node', $node);        $replaced_message .= "\n<br />" . token_replace($form_state['values']['personal_message'], 'node', $node);
# Line 175  function node_invite_send_submit($form, Line 180  function node_invite_send_submit($form,
180    
181    // send them somewhere... back to the node!    // send them somewhere... back to the node!
182    drupal_set_message($send_count . ' messages sent');    drupal_set_message($send_count . ' messages sent');
183    $form_state['redirect'] = "node/" . $form_state['values']['nid'];    $form_state['redirect'] = "node/" . $node->nid;
184  }  }
185    

Legend:
Removed from v.1.4.2.2  
changed lines
  Added in v.1.4.2.3

  ViewVC Help
Powered by ViewVC 1.1.2