Making WordPress.org


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

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

File:
1 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;
Note: See TracChangeset for help on using the changeset viewer.