Making WordPress.org

Changeset 5592


Ignore:
Timestamp:
06/21/2017 05:50:02 PM (9 years ago)
Author:
iandunn
Message:

Official WordPress Events: Only include groups where the WP user is organizer

There are a handful of groups that the WordPress user has joined, but has no role in, or has the Co-Organizer role. Those groups haven't joined the chapter program, or have started the process of joining, but not completed it. The intent of this plugin -- and everything that pulls data from it -- is to only promote events that are part of the chapter program.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/official-wordpress-events.php

    r5146 r5592  
    417417
    418418            if ( ! empty ( $body->results ) ) {
    419                 $groups    = wp_list_pluck( $body->results, 'group' );
    420                 $group_ids = array_merge( $group_ids, wp_list_pluck( $groups, 'id' ) );
     419                foreach ( $body->results as $profile ) {
     420                    if ( ! isset( $profile->group->id, $profile->role ) || 'Organizer' !== $profile->role ) {
     421                        continue;
     422                    }
     423
     424                    $group_ids[] = $profile->group->id;
     425                }
    421426            }
    422427
Note: See TracChangeset for help on using the changeset viewer.