Making WordPress.org


Ignore:
Timestamp:
05/17/2021 06:57:24 PM (3 years ago)
Author:
ryelle
Message:

Pattern Directory: Sync with git WordPress/pattern-directory@4325f4c27e58232cc4a5553bad65ba258947742f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php

    r10930 r10983  
    44
    55use const WordPressdotorg\Pattern_Directory\Pattern_Post_Type\POST_TYPE;
     6use const WordPressdotorg\Pattern_Directory\Pattern_Flag_Post_Type\POST_TYPE as FLAG_POST_TYPE;
    67
    78add_action( 'after_setup_theme', __NAMESPACE__ . '\setup' );
     
    137138    return __DIR__ . '/index.php';
    138139}
     140
     141/**
     142 * Checks whether the user has a pending flag for a specific pattern.
     143 *
     144 * @return bool
     145 */
     146function user_has_flagged_pattern() {
     147    $args = array(
     148        'author' => get_current_user_id(),
     149        'post_parent' => get_the_ID(),
     150        'post_type' => FLAG_POST_TYPE,
     151        'post_status' => 'pending',
     152    );
     153
     154    $items = new \WP_Query( $args );
     155
     156    return $items->have_posts();
     157}
Note: See TracChangeset for help on using the changeset viewer.