Making WordPress.org


Ignore:
Timestamp:
04/05/2016 04:05:02 PM (8 years ago)
Author:
kovshenin
Message:

WordCamp.org: Reintegrate application-tracking branch into trunk.

Location:
sites/trunk/wordcamp.org
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org

  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wcorg-json-api.php

    r2358 r2898  
    11<?php
    2 
    32/*
    43 * Customizations to the JSON REST API
     
    2322// Allow some routes to skip the JSON REST API v1 plugin.
    2423add_action( 'parse_request', 'wcorg_json_v2_compat', 9 );
     24
     25// Allow users to read new post statuses.
     26add_filter( 'json_check_post_read_permission', 'wcorg_json_check_post_read_permission', 10, 2 );
    2527
    2628/**
     
    372374    return;
    373375}
     376
     377function wcorg_json_check_post_read_permission( $permission, $post ) {
     378    if ( $permission || ! defined( 'WCPT_POST_TYPE_ID' ) ) {
     379        return $permission;
     380    }
     381
     382    if ( $post['post_type'] != WCPT_POST_TYPE_ID ) {
     383        return $permission;
     384    }
     385
     386    return in_array( $post['post_status'], WordCamp_Loader::get_public_post_statuses() );
     387}
Note: See TracChangeset for help on using the changeset viewer.