Results 1 to 1 of 1

Thread: Send rejected coupon notification email

  1. #1
    Thread Starter
    day2design's Avatar
    Join Date
    Dec 2012
    Location
    Australia
    Posts
    9
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Send rejected coupon notification email

    Does anyone know how to send a rejected coupon notification email to the coupon owner when a coupon is rejected / trashed?

    @laura came up with code for how to do it in Classipress - (https://forums.appthemes.com/report-...to-email-32609), I'm looking to do the same for clipper.


    I guess it would be very similar to code that sends an *approved* coupon notification email to coupon owner found in themes/clipper/includes/emails.php i.e.

    /**
    * Sends approved coupon notification email to coupon owner.
    *
    * @param object $post
    *
    * @return void
    */
    function clpr_notify_coupon_owner_email( $post ) {
    global $current_user;

    if ( $post->post_type != APP_POST_TYPE ) {
    return;
    }

    // Check that the coupon was not approved by the owner
    if ( $post->post_author == $current_user->ID ) {
    return;
    }

    $coupon_title = stripslashes( $post->post_title );

    $coupon_author = stripslashes( clpr_get_user_name( $post->post_author ) );
    $coupon_author_email = stripslashes( get_the_author_meta( 'user_email', $post->post_author ) );

    // check to see if ad is legacy or not
    if ( get_post_meta( $post->ID, 'email', true ) ) {
    $mailto = get_post_meta( $post->ID, 'email', true );
    } else {
    $mailto = $coupon_author_email;
    }

    // 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_bloginfo( 'name' ), ENT_QUOTES );
    $subject = __( 'Your Coupon Has Been Approved', APP_TD );

    $message = html( 'p', sprintf( __( 'Hi %s,', APP_TD ), $coupon_author ) ) . PHP_EOL;
    $message .= html( 'p', sprintf( __( 'Your coupon, "%s" has been approved and is now live on our site.', APP_TD ), $coupon_title ) ) . PHP_EOL;
    $message .= html( 'p', __( 'You can view your coupon by clicking on the following link:', APP_TD ) . '<br />' . html_link( get_permalink( $post->ID ) ) ) . PHP_EOL;
    $message .= html( 'p',
    __( 'Regards,', APP_TD ) . '<br />' .
    sprintf( __( 'Your %s Team', APP_TD ), $blogname ) . '<br />' .
    html_link( home_url( '/' ) )
    ) . PHP_EOL;

    $email = array( 'to' => $mailto, 'subject' => $subject, 'message' => $message );
    $email = apply_filters( 'clpr_email_user_coupon_approved', $email, $post );

    appthemes_send_email( $email['to'], $email['subject'], $email['message'] );
    }
    add_action( 'pending_to_publish', 'clpr_notify_coupon_owner_email', 10, 1 );
    add_action( 'draft_to_publish', 'clpr_notify_coupon_owner_email', 10, 1 );

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Send inquiry email/notification not working
    By designpad46 in forum Report ClassiPress Bugs
    Replies: 0
    Last Post: December 27th, 2016, 11:35 PM
  2. Neither notification nor email sent to rejected bidders
    By olponom in forum Help Using HireBee
    Replies: 0
    Last Post: January 20th, 2015, 03:57 PM
  3. New User Email Plugin in 3.02 BUG - Send Notification Email
    By zontor in forum ClassiPress General Discussion
    Replies: 15
    Last Post: December 25th, 2013, 12:23 PM
  4. Send email when joblisting rejected
    By loker in forum Report JobRoller Bugs
    Replies: 1
    Last Post: July 13th, 2011, 10:42 AM