Making WordPress.org


Ignore:
Timestamp:
08/17/2023 04:10:57 AM (21 months ago)
Author:
dd32
Message:

Theme Directory: When a theme is published, mark the GlotPress project and wp-themes.com as available.

See #7213.

File:
1 edited

Legend:

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

    r12600 r12845  
    11181118
    11191119/**
    1120  * Hooks into the Suspend process to mark a theme as inactive in GlotPress.
     1120 * Hooks into the Suspend/Draft process to mark a theme as inactive in GlotPress.
    11211121 *
    11221122 * @param int  $post_id The post ID being suspended
     
    11291129
    11301130    wporg_themes_glotpress_import( $post, 'inactive' );
     1131    wporg_themes_remove_wpthemescom( $post->post_name );
    11311132}
    11321133add_action( 'suspend_repopackage', 'wporg_themes_glotpress_mark_as_inactive_on_suspend' );
     1134add_action( 'publish_to_draft', 'wporg_themes_glotpress_mark_as_inactive_on_suspend' );
     1135
     1136/**
     1137 * Hooks into the publish process to mark a theme as active in GlotPress if it was deactivated.
     1138 *
     1139 * @param int  $post_id The post ID being published
     1140 */
     1141function wporg_themes_glotpress_mark_as_active_on_publish( $post_id ) {
     1142    $post           = get_post( $post_id );
     1143    $latest_version = array_search( 'live', $post->_status ?: [] );
     1144    if ( ! $latest_version ) {
     1145        return;
     1146    }
     1147
     1148    wporg_themes_glotpress_import( $post, $latest_version );
     1149    wporg_themes_update_wpthemescom( $post->post_name, $latest_version );
     1150}
     1151add_action( 'publish_repopackage', 'wporg_themes_glotpress_mark_as_active_on_publish' );
    11331152
    11341153/**
Note: See TracChangeset for help on using the changeset viewer.