Index: addons/require-login.php
===================================================================
--- addons/require-login.php	(revision 978284)
+++ addons/require-login.php	(working copy)
@@ -47,6 +47,7 @@
 
 		// Misc
 		add_filter( 'camptix_attendees_shortcode_query_args',         array( $this, 'hide_unconfirmed_attendees' ) );
+		add_action( 'tix_scheduled_daily',                            array( $this, 'remind_unconfirmed_attendees' ) );
 	}
 
 	/**
@@ -307,7 +308,7 @@
 	 */
 	public function get_attendee_search_meta( $attendee_search_meta ) {
 		$attendee_search_meta[] = 'tix_username';
-		
+
 		return $attendee_search_meta;
 	}
 
@@ -352,6 +353,16 @@
 			'callback_method' => 'field_textarea',
 		);
 
+		$templates['email_template_unconfirmed_attendee_reminder'] = array(
+			'title'           => __( 'Multiple Purchase Reminder (to unconfirmed attendees)', 'camptix' ),
+			'callback_method' => 'field_textarea',
+		);
+
+		$templates['email_template_unknown_attendee_reminder'] = array(
+			'title'           => __( 'Multiple Purchase Reminder (for unknown attendees)', 'camptix' ),
+			'callback_method' => 'field_textarea',
+		);
+
 		return $templates;
 	}
 
@@ -367,6 +378,10 @@
 		$options['email_template_multiple_purchase_unconfirmed_attendee']          = __( "Hi there!\n\nA ticket to [event_name] has been purchased for you by [buyer_full_name].\n\nPlease visit the following page and fill in your information to complete your registration:\n\n[ticket_url]\n\nLet us know if you have any questions!", 'camptix' );
 		$options['email_template_multiple_purchase_unknown_attendee']              = __( "Hi there!\n\nThis e-mail is for the unknown attendee that you purchased a ticket for. When you decide who will be using the ticket, please forward the link below to them so that they can complete their registration.\n\n[ticket_url]\n\nLet us know if you have any questions!", 'camptix' );
 
+		// TODO: populate reminder templates with appropriate content
+		$options['email_template_unconfirmed_attendee_reminder']                   = __( "Hi there!\n\nA ticket to [event_name] has been purchased for you.\n\nTo complete your registration, please confirm your ticket by visiting the following page:\n\n[ticket_url]\n\nLet us know if you have any questions!", 'camptix' );
+		$options['email_template_unknown_attendee_reminder']                       = __( "Hi there!\n\nThis e-mail is for the unknown attendee that you purchased a ticket for. When you decide who will be using the ticket, please forward the link below to them so that they can complete their registration.\n\n[ticket_url]\n\nLet us know if you have any questions!", 'camptix' );
+
 		return $options;
 	}
 
@@ -394,6 +409,16 @@
 				}
 
 				break;
+			case 'email_template_unconfirmed_reminder':
+				$unknown_attendee_info = $this->get_unknown_attendee_info();
+
+				if ( $unknown_attendee_info['email'] == get_post_meta( $attendee->ID, 'tix_email', true ) ) {
+					$template = 'email_template_unknown_attendee_reminder';
+				} elseif ( self::UNCONFIRMED_USERNAME == get_post_meta( $attendee->ID, 'tix_username', true ) ) {
+					$template = 'email_template_unconfirmed_attendee_reminder';
+				}
+
+				break;
 		}
 
 		return $template;
@@ -760,6 +785,108 @@
 
 		return $query_args;
 	}
-} // CampTix_Require_Login 
 
+	/**
+	 * send reminders to the unconfirmed attendees
+	 *
+	 * TODO:
+	 * - get proper text for the subject and body for each situation;
+	 *
+	 * @return array
+	 */
+	public function remind_unconfirmed_attendees() {
+		global $shortcode_tags, $camptix;
+
+		// get Camp date
+		$wordcamp = get_wordcamp_post();
+
+		// set up a couple dates to use for calculations
+		$wordcamp_date = strtotime( $wordcamp->meta['Start Date (YYYY-mm-dd)'][0] );
+		$days_until_camp = floor( ( $wordcamp_date - $now ) / DAY_IN_SECONDS );
+		$now = strtotime( 'now' );
+
+		// only remind unconfirmed attendees within the 24 days prior to the Camp
+		// NOTE: may want to set the days before camp to be a constant - using 24 for now
+		if ( $now >= $wordcamp_date || $days_until_camp > 24 ) {
+			return;
+		}
+
+		// set things up now that we are within a month before the Camp
+
+		// if Camp is 7 days or more away set the interval to 7 days for at most weekly reminders.
+		// if Camp is less than 7 days away sneak in another reminder at about 3 days out
+		if ( 7 <= $days_until_camp ) {
+			$max_date_for_notification = strtotime( 'now - 7 days' );
+		} else {
+			$max_date_for_notification = strtotime( 'now - 4 days' );
+		}
+
+		// Remove all shortcodes before sending the e-mails, but bring them back later.
+		$this->removed_shortcodes = $shortcode_tags;
+		remove_all_shortcodes();
+
+		// setup shortcodes for these email templates
+		do_action( 'camptix_init_email_templates_shortcodes' );
+
+		$default_attendee_values = $this->get_unknown_attendee_info();
+
+		$query_args = array(
+			'post_type'			=> 'tix_attendee',
+			'post_status'		=> 'publish',
+			'posts_per_page'	=> -1,
+			'meta_query'		=> array(
+				array(
+					'key'		=> 'tix_username',
+					'value'		=> self::UNCONFIRMED_USERNAME,
+					'compare'	=> '='
+				)
+			),
+		);
+
+		$unconfirmed_attendees = get_posts( $query_args );
+
+		$subject = sprintf( __( "%s Unconfirmed Ticket Reminder", 'camptix' ), $wordcamp->post_title );
+
+		foreach( $unconfirmed_attendees AS $attendee ) {
+
+			// set camptix attendee ID
+			$camptix->tmp( 'attendee_id', $attendee->ID );
+
+			// get attendee meta
+			$attendee_meta = get_post_custom( $attendee->ID );
+			$last_reminder_sent_date = empty( $attendee_meta['tix_last_unconfirmed_reminder_date(YYYY-mm-dd)'] ) ? 0 : strtotime( $attendee_meta['tix_last_unconfirmed_reminder_date(YYYY-mm-dd)'] );
+
+			// check last reminder sent - if set, make sure at least 7 days have passed before sending another
+			if ( $last_reminder_sent_date > $max_date_for_notification ) {
+				continue;
+			}
+
+			// set notification vars
+			 $camptix->tmp( 'ticket_url', $camptix->get_edit_attendee_link( $attendee->ID, $attendee_meta['tix_edit_token'] ) );
+
+			// if there is an email address for the unconfirmed attendee use it, else use the receipt email address
+			if ( $default_attendee_values['email'] !== $attendee_meta['tix_email'] ) {
+				$send_to = $attendee_meta['tix_email'];
+			} else {
+				$send_to = $attendee_meta['tix_receipt_email'];
+			}
+			$email_template = apply_filters( 'camptix_email_tickets_template', 'email_template_unconfirmed_reminder', $attendee );
+			$content = do_shortcode( $camptix->options[ $email_template ] );
+
+			// send message
+			if ( $camptix->wp_mail( $send_to, $subject, $content ) ) {
+				// if mail successfull set last reminder sent date meta
+				update_post_meta( $attendee->ID, 'tix_last_unconfirmed_reminder_date(YYYY-mm-dd)', date( 'Y-m-d' ) );
+			}
+
+		}
+
+		// Bring the original shortcodes back.
+		$shortcode_tags = $this->removed_shortcodes;
+		$this->removed_shortcodes = array();
+
+	}
+
+} // CampTix_Require_Login
+
 camptix_register_addon( 'CampTix_Require_Login' );
