 
			
			 
			
			
			
			
			
				 
			
			 
			
				// EMAIL:  Job Pack Expired (used up)
remove_action( 'jr_expire_user_pack', 'jr_owner_pack_expired_email', 10, 2 );
add_action( 'jr_expire_user_pack', 'jr_job_pack_used_email', 10, 2 );
// if the pack has expired, send an email to the pack owner
function jr_job_pack_used_email( $user_id, $plan_umeta_id ) {
	global $jr_log;
	$pack_meta = _jr_user_pack_meta( $user_id, $plan_umeta_id );
	if ( empty($pack_meta['plan_id']) )
		return;
	$plan = get_post_custom( $pack_meta['plan_id'] );
	if ( empty($plan['title'][0]) )
		return;
	$pack_name = $plan['title'][0];
	$pack_author = stripslashes(get_the_author_meta('user_login', $user_id));
	$pack_author_email = stripslashes(get_the_author_meta('user_email', $user_id));
	$dashurl = trailingsla****( get_permalink( JR_Dashboard_Page::get_id() ) );
	// The blogname option is escaped with esc_html on the way into the database in sanitize_option
	// we want to reverse this for the plain text arena of emails.
	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
	$mailto = $pack_author_email;
	$subject = sprintf( __( '[%s] Thank You For Your Order', APP_TD ), $blogname );
	$message  = sprintf( __( 'Hello %s,', APP_TD), $pack_author ) . PHP_EOL . PHP_EOL;
	$message .= sprintf( __( 'Allow this email to serve as notification that Your "%s", purchased in "%s", has ended.', APP_TD), $pack_name, appthemes_display_date( intval($pack_meta['start_date']), 'date' ) ) . PHP_EOL . PHP_EOL;
	$message .= __( 'This simply means that you\'ve reached the limit as to how many job listings you may place under the terms of that particular listing package that you purchased.</br></br>We certainly appreciate your business and hope that you\'ll consider placing further listings with us.  We\'re helping to match qualified candidates with employers every day.', APP_TD ) . PHP_EOL . PHP_EOL;
	if ( jr_allow_purchase_separate_packs() ) {
		$message .= __( 'To purchase new packs, please go to your Dashboard and click "Buy Packs", under the "Job Packs" Tab.', APP_TD ) . PHP_EOL;
		$message .= $dashurl . PHP_EOL . PHP_EOL . PHP_EOL . PHP_EOL;
	}
	$message .= jr_email_signature( 'expired_pack' );
	// ok let's send the email
	wp_mail( $mailto, $subject, $message, _jr_email_headers() );
	$jr_log->write_log( 'Email Sent to author ('.$pack_author.'): Your Pack Has Expired ('.$pack_author.')' );
}
There are currently 1 users browsing this thread. (0 members and 1 guests)