Results 1 to 1 of 1

Thread: Editing Theme Emails using hooks

  1. #1
    Thread Starter
    kdubose's Avatar
    Join Date
    Sep 2011
    Location
    United States
    Posts
    168
    Thanks
    3
    Thanked 2 Times in 2 Posts

    Editing Theme Emails using hooks

    I'm attempting to edit the email that goes out when the job pack expires. I'm using the following code in my functions file. I'm removing the action and adding a custom action for this particular email. However, it's still sending the email found in theme-emails.php instead of removing that function and using my custom one. Do you see anything wrong with this? It's the code in my functions file.

    Code:
    // 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.')' );
    
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Jomark Editing emails sent to customers
    By childcarejobs in forum Help Using JobRoller
    Replies: 1
    Last Post: July 12th, 2013, 10:22 AM
  2. Child Theme Functions & Hooks
    By lucrothe in forum Vantage General Discussion (Legacy)
    Replies: 0
    Last Post: May 23rd, 2013, 11:56 PM
  3. Related Ads using hooks (functions.php) in child theme
    By plink in forum ClassiPress General Discussion
    Replies: 4
    Last Post: May 5th, 2012, 02:22 AM
  4. [SOLVED] Editing listing confirmation emails
    By carmagedon in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: December 29th, 2011, 10:19 AM
  5. Replies: 3
    Last Post: September 11th, 2010, 06:48 PM