/[drupal]/contributions/modules/node_invite/node_invite.module
ViewVC logotype

Diff of /contributions/modules/node_invite/node_invite.module

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

revision 1.11.2.2, Wed Sep 2 07:35:01 2009 UTC revision 1.11.2.3, Thu Sep 3 00:17:30 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: node_invite.module,v 1.11.2.1 2009/09/02 00:56:32 hadsie Exp $  // $Id: node_invite.module,v 1.11.2.2 2009/09/02 07:35:01 hadsie Exp $
3  /**  /**
4   * @file   * @file
5   * Provides the overall functionality for the node_invite module.   * Provides the overall functionality for the node_invite module.
# Line 158  function node_invite_rsvp_title($node, $ Line 158  function node_invite_rsvp_title($node, $
158  /**  /**
159   * Implementation of hook_load().   * Implementation of hook_load().
160   */   */
161  function node_invite_load($iid, $reset = NULL) {  function node_invite_load($invite_id, $reset = NULL) {
162    static $invite_cache = array();    static $invite_cache = array();
163    if ($reset) {    if ($reset) {
164      $invite_cache = array();      $invite_cache = array();
165    }    }
166    if (!isset($invite_cache[$hash])) {    if (!isset($invite_cache[$invite_id])) {
167      $invite_cache[$iid] = db_fetch_object(db_query("SELECT * FROM {node_invites} WHERE iid = %d", $iid));      // The id can be either a hash or an iid... figure it out
168        if (is_numeric($invite_id)) {
169          $invite_cache[$invite_id] = db_fetch_object(db_query("SELECT * FROM {node_invites} WHERE iid = %d", $invite_id));
170        }
171        else {
172          $invite_cache[$invite_id] = db_fetch_object(db_query("SELECT * FROM {node_invites} WHERE hash = '%s'", $invite_id));
173        }
174    }    }
175    return $invite_cache[$iid];    return $invite_cache[$invite_id];
176  }  }
177    
178  /**  /**
# Line 446  function node_invite_resend_submit($form Line 452  function node_invite_resend_submit($form
452    if ($row = db_fetch_array($q)) {    if ($row = db_fetch_array($q)) {
453      $default_message = variable_get('node_invite_message_default', NODE_INVITE_MESSAGE_DEFAULT);      $default_message = variable_get('node_invite_message_default', NODE_INVITE_MESSAGE_DEFAULT);
454      $node = node_load($row['nid']);      $node = node_load($row['nid']);
455      $inviter_rsvp_url = url('node_invite/rsvp/' . $row['nid'] . '/' . $row['iid'], array('absolute' => TRUE));      $inviter_rsvp_url = url(node_invite_rsvp_path($row['iid']), array('absolute' => TRUE));
456      $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);
457      $replaced_message = token_replace($new_default_message, 'node', $node);      $replaced_message = token_replace($new_default_message, 'node', $node);
458      $subj = token_replace(      $subj = token_replace(
# Line 764  function node_invite_form_alter(&$form, Line 770  function node_invite_form_alter(&$form,
770      );      );
771    }    }
772  }  }
773    
774    /**
775     * Return the path for the RSVP page for the specified invite.
776     */
777    function node_invite_rsvp_path($invite) {
778      if (!is_object($invite)) {
779        $invite = node_invite_load($invite);
780      }
781    
782      $url = 'node_invite/rsvp/' . $invite->nid . '/';
783      if (variable_get('node_invite_hash_urls', FALSE)) {
784        $url .= $invite->hash;
785      }
786      else {
787        $url .= $invite->iid;
788      }
789      return $url;
790    }

Legend:
Removed from v.1.11.2.2  
changed lines
  Added in v.1.11.2.3

  ViewVC Help
Powered by ViewVC 1.1.2