Making WordPress.org

Changeset 7913


Ignore:
Timestamp:
11/29/2018 03:19:23 AM (7 years ago)
Author:
iandunn
Message:

CampTix Badge Generator: Add ability to query by admin flag.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/camptix-badge-generator/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/camptix-badge-generator/includes/common.php

    r6768 r7913  
    7272 * @param string       $registered_after Reduce fetched attendees by their registration date. Any value parseable
    7373 *                                       by strtotime().
     74 * @param string       $admin_flag       Filter fetched attendees to only those who have the given admin flag
     75 *                                       assigned.
    7476 *
    7577 * @todo Maybe optimize this by looking at post_date rather than tix_timestamp
     
    7779 * @return array
    7880 */
    79 function get_attendees( $ticket_ids = 'all', $registered_after = '' ) {
     81function get_attendees( $ticket_ids = 'all', $registered_after = '', $admin_flag = '' ) {
    8082    $params = array(
    8183        'post_type'      => 'tix_attendee',
     
    103105
    104106    $attendees = get_posts( $params );
     107
     108    if ( '' !== $admin_flag ) {
     109        $attendees = array_filter( $attendees, function( $attendee ) use ( $admin_flag ) {
     110            $flags = get_post_meta( $attendee->ID, 'camptix-admin-flag' );
     111
     112            return in_array( $admin_flag, $flags, true );
     113        } );
     114    }
    105115
    106116    return $attendees;
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/camptix-badge-generator/includes/indesign-badges.php

    r6768 r7913  
    3434            'ticket_ids'       => 'all',
    3535            'registered_after' => '',
     36            'admin_flag'       => '',
    3637        ),
    3738        $options
     
    4546        $zip_filename     = get_zip_filename( $assets_folder );
    4647        $zip_local_folder = pathinfo( $zip_filename, PATHINFO_FILENAME );
    47         $attendees        = Badge_Generator\get_attendees( $options['ticket_ids'], $options['registered_after'] );
     48        $attendees        = Badge_Generator\get_attendees( $options['ticket_ids'], $options['registered_after'], $options['admin_flag'] );
    4849
    4950        wp_mkdir_p( $gravatar_folder );
Note: See TracChangeset for help on using the changeset viewer.