Making WordPress.org


Ignore:
Timestamp:
08/13/2020 02:39:38 PM (5 years ago)
Author:
iandunn
Message:

Events: Pin next Learn discussion group to Events Widget.

This is hardcoded for today's event, but a future commit will make this dynamic.

See https://make.wordpress.org/community/2020/08/12/learn-wordpress-is-live/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/index.php

    r10113 r10165  
    183183        $events = pin_next_online_wordcamp( $events, $_SERVER['HTTP_USER_AGENT'], time() );
    184184
     185        $events = pin_next_workshop_discussion_group( $events, $_SERVER['HTTP_USER_AGENT'] );
     186
    185187        $events = remove_duplicate_events( $events );
    186188
     
    12561258
    12571259/**
    1258  * Pin the next upcoming online WordCamp.
     1260 * Pin the next upcoming online WordCamp to the Events Widget.
    12591261 *
    12601262 * @param array  $events
     
    13371339
    13381340/**
     1341 * Pin upcoming learn.wordpress.org discussion groups to the Events Widget.
     1342 *
     1343 * @param array  $events
     1344 * @param string $user_agent
     1345 *
     1346 * @return array
     1347 */
     1348function pin_next_workshop_discussion_group( $events, $user_agent ) {
     1349    if ( ! is_client_core( $user_agent ) ) {
     1350        return $events;
     1351    }
     1352
     1353    if ( time() <= strtotime( '2020-08-13 2pm PDT' ) ) {
     1354        array_unshift(
     1355            $events,
     1356            array(
     1357                'type'       => 'meetup',
     1358                'title'      => 'Discussion Group: Introduction to Contributing to WordPress',
     1359                'url'        => 'https://www.meetup.com/learn-wordpress-discussions/events/272512607/',
     1360                'meetup'     => 'Learn WordPress',
     1361                'meetup_url' => 'https://www.meetup.com/learn-wordpress-discussions/',
     1362                'date'       => '2020-08-13 14:00:00',
     1363                'end_date'   => '2020-08-13 15:00:00',
     1364
     1365                'location'   => array(
     1366                    'location'  => 'Online',
     1367                    'country'   => 'US',
     1368                    'latitude'  => 37.78,
     1369                    'longitude' => -122.42,
     1370                )
     1371            )
     1372        );
     1373    }
     1374
     1375    return $events;
     1376}
     1377
     1378/**
    13391379 * Remove duplicate events, based on the URL.
    13401380 *
Note: See TracChangeset for help on using the changeset viewer.