Making WordPress.org


Ignore:
Timestamp:
02/28/2019 03:34:07 PM (7 years ago)
Author:
vedjain
Message:

WCPT: Multiple minor fixes. See description.

  1. Added check while sending declined / scheduled notifications for WordCamp / Meetup, so that we do not send duplicate notifications for same event.
  2. Removed meetup organizer reminder cron because we are not using it anymore. This was already disabled, and this patch just removes dead code from codebase.
  3. Applied code standard and fixes in multiple places.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/class-event-admin.php

    r8262 r8374  
    259259     * @return string
    260260     */
    261     public function set_locale_to_en_US() {
     261    public function set_locale_to_en_us() {
    262262        return 'en_US';
    263263    }
     
    280280
    281281        // Ensure status labels are in English.
    282         add_filter( 'locale', array( $this, 'set_locale_to_en_US' ) );
     282        add_filter( 'locale', array( $this, 'set_locale_to_en_us' ) );
    283283
    284284        $old_status = get_post_status_object( $old_status );
     
    302302
    303303        // Remove the temporary locale change.
    304         remove_filter( 'locale', array( $this, 'set_locale_to_en_US' ) );
     304        remove_filter( 'locale', array( $this, 'set_locale_to_en_us' ) );
    305305    }
    306306
     
    315315
    316316    /**
    317      * Schedule notificaiton for declined application. Currently supports WordCamp and Meetup
     317     * Schedule notification for declined application. Currently supports WordCamp and Meetup.
    318318     *
    319319     * @param WP_Post $event Event object.
     
    331331     * @param string $label
    332332     * @param string $location
     333     *
     334     * @return null|bool|string
    333335     */
    334336    public static function send_decline_notification( $event_id, $label, $location ) {
     337        $declined_notification_key = 'sent_declined_notification';
     338        if ( get_post_meta( $event_id, $declined_notification_key, true ) ) {
     339            return null;
     340        }
     341
    335342        $message = sprintf(
    336343            'A %s application for %s has been declined, and the applicant has been informed via email.',
     
    340347
    341348        $attachment = create_event_status_attachment( $message, $event_id, '' );
    342         wcpt_slack_notify( COMMUNITY_TEAM_SLACK, $attachment );
     349
     350        $notification_sent = wcpt_slack_notify( COMMUNITY_TEAM_SLACK, $attachment );
     351        if ( $notification_sent ) {
     352            update_post_meta( $event_id, $declined_notification_key, true );
     353        }
     354        return $notification_sent;
    343355    }
    344356
     
    443455
    444456        // Don't add/remove meta on trash, untrash, restore, etc.
     457        // phpcs:ignore WordPress.Security.NonceVerification.Missing
    445458        if ( empty( $_POST['action'] ) || 'editpost' !== $_POST['action'] ) {
    446459            return;
     
    453466            }
    454467        }
    455 
    456468
    457469        $meta_keys = $this->meta_keys();
Note: See TracChangeset for help on using the changeset viewer.