Making WordPress.org


Ignore:
Timestamp:
06/28/2023 02:11:16 AM (3 years ago)
Author:
dd32
Message:

Make: GitHub Invite Tool: Allow specifying a GitHub user URL, and if the user is a member of the org already, just add them to the team(s).

See #7082.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-github-invite/api.php

    r12671 r12678  
    8383
    8484/**
     85 * Add an organisation member to a team.
     86 *
     87 * @param int|string $who      The GitHub user login.
     88 * @param array      $team_ids The team IDs to add the user to.
     89 */
     90function add_to_team( $who, array $team_ids ) {
     91    $error = new WP_Error;
     92
     93    foreach ( $team_ids as $team_id ) {
     94        $response = api(
     95            "/orgs/{ORG}/team/{$team_id}/memberships/{$who}",
     96            false,
     97            'PUT'
     98        );
     99
     100        if ( is_wp_error( $response ) ) {
     101            $error->merge_from( $response );
     102        }
     103    }
     104
     105    if ( $error->get_error_code() ) {
     106        return $error;
     107    }
     108
     109    return $response;
     110}
     111
     112/**
    85113 * Cancel an invitation by ID
    86114 */
     
    92120    );
    93121}
    94 
    95122
    96123/**
Note: See TracChangeset for help on using the changeset viewer.