Making WordPress.org


Ignore:
Timestamp:
02/25/2016 01:55:55 AM (11 years ago)
Author:
kovshenin
Message:

WordCamp.org: Fix notify_requester_payment_made() for new payment request statuses.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php

    r2608 r2609  
    585585
    586586        /**
    587          * Set the request's status based on whether the vendor has been paid.
    588          *
    589          * @param array $post_data
    590          * @param array $post_data_raw
    591          * @return array
    592          */
    593         public function update_request_status( $post_data, $post_data_raw ) {
    594                 if ( ! WordCamp_Budgets::post_edit_is_actionable( $post_data, self::POST_TYPE ) )
    595                         return $post_data;
    596 
    597                         // if ( $this->should_mark_request_incomplete() ) {
    598                         //      $post_data['post_status'] = 'incomplete';
    599                         //      $this->notify_requester_request_incomplete( $post_data_raw['ID'], $post_data, $post_data_raw );
    600                         //
    601                         //      update_post_meta( $post_data_raw['ID'], '_wcp_incomplete_notes', sanitize_text_field( $post_data_raw['wcp_mark_incomplete_notes'] ) );
    602                         // } else {
    603                 $previous_status = $post_data['post_status'];
    604                 $valid_paid_date = false !== strtotime( sanitize_text_field( $_POST['date_vendor_paid'] ) );
    605                 // todo realign
    606 
    607 
    608                 // if ( 'paid' != $previous_status && 'paid' == $post_data['post_status'] ) {
    609                 //      $this->notify_requester_payment_made( $post_data_raw['ID'], $post_data );
    610                 // }
    611                         // }
    612 
    613                 return $post_data;
    614         }
    615 
    616         /**
    617587         * Ensure that new posts have the `post_date_gmt` field populated.
    618588         *
    … …  
    637607         * Notify the payment requester that it has been marked as paid.
    638608         *
    639          * @param int   $request_id
    640          * @param array $post_data
    641          */
    642         protected function notify_requester_payment_made( $request_id, $post_data ) {
    643                 if ( ! $to = WordCamp_Budgets::get_requester_formatted_email( $post_data['post_author'] ) ) {
     609         * @param int|WP_Post $post
     610         */
     611        protected function notify_requester_payment_made( $post ) {
     612                $post = get_post( $post );
     613
     614                if ( ! $to = WordCamp_Budgets::get_requester_formatted_email( $post->post_author ) ) {
    644615                        return;
    645616                }
    646617
    647                 $subject = sprintf( '`%s` has been paid', $post_data['post_title'] );
     618                $subject = sprintf( '"%s" has been paid', $post->post_title );
    648619                $headers = array( 'Reply-To: support@wordcamp.org' );
    649620
    650621                $message = sprintf(
    651                         "The request for `%s` has been marked as paid by WordCamp Central.
     622                        "The request for \"%s\" has been marked as paid by WordCamp Central.
    652623
    653624                        You can view the request at:
    … …  
    656627
    657628                        If you have any questions, please reply to let us know.",
    658                         $post_data['post_title'],
    659                         admin_url( sprintf( 'post.php?post=%s&action=edit', $request_id ) )
     629                        $post->post_title,
     630                        admin_url( sprintf( 'post.php?post=%s&action=edit', $post->ID ) )
    660631                );
    661632                $message = str_replace( "\t", '', $message );
    … …  
    743714
    744715                                $this->notify_requester_request_incomplete( $post->ID );
     716                                WordCamp_Budgets::log( $post->ID, $user->ID, 'Incomplete notification e-mail sent.', array(
     717                                        'action' => 'incomplete-notification-sent',
     718                                ) );
    745719
    746720                        } elseif ( $new == 'paid' || $new == 'wcb-paid' ) {
    … …  
    748722                                        'action' => 'marked-paid',
    749723                                ) );
     724
     725                                $this->notify_requester_payment_made( $post->ID );
     726                                WordCamp_Budgets::log( $post->ID, $user->ID, 'Paid notification e-mail sent.', array(
     727                                        'action' => 'paid-notification-sent',
     728                                ) );
     729
    750730                        } elseif ( $old == 'auto-draft' ) {
    751731                                WordCamp_Budgets::log( $post->ID, $user->ID, 'Request created', array(
Note: See TracChangeset for help on using the changeset viewer.