<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[1219] sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory: WP.org Themes: Remove approval workflow.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/1219">1219</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/1219","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>obenland</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-02-04 18:37:01 +0000 (Wed, 04 Feb 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WP.org Themes: Remove approval workflow.
Theme Review Admins do a final check on Trac and set themes live from there.
For the off chance that a ticket needs manual adjustment, version statuses can
be changed in the edit screen of a repopackage item.
This also removes Trac syncing, in order for it to be added as a script on the
dotorg side.
See https://wordpress.slack.com/archives/meta/p1423071510000491
See <a href="http://meta.trac.wordpress.org/ticket/745">#745</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectoryclasswporgthemesrepopackagephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-repo-package.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectoryclasswporgthemesuploadphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectorythemedirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectoryclasswporgthemesrepopackagephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-repo-package.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-repo-package.php 2015-02-04 07:50:02 UTC (rev 1218)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-repo-package.php 2015-02-04 18:37:01 UTC (rev 1219)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -30,11 +30,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return int|string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function latest_version() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If we're looking at themes awaiting approval, use the corresponding version.
- if ( current_user_can( 'approve_themes' ) && isset( $_REQUEST['meta_key'] ) && '_has_pending_version' == $_REQUEST['meta_key'] ) {
- return get_post_meta( $this->wp_post->ID, '_has_pending_version', true );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $status = get_post_meta( $this->wp_post->ID, '_status', true );
</span><span class="cx" style="display: block; padding: 0 10px"> uksort( $status, 'version_compare' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectoryclasswporgthemesuploadphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php 2015-02-04 07:50:02 UTC (rev 1218)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php 2015-02-04 18:37:01 UTC (rev 1219)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -469,8 +469,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->trac = new Trac( 'themetracbot', THEME_TRACBOT_PASSWORD, 'https://themes.trac.wordpress.org/login/xmlrpc' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If there's a previous version, and the most current version's status is either `new` or `pending`, we update.
- if ( ! empty( $this->theme_post->max_version ) && in_array( $this->theme_post->_status[ $this->theme_post->max_version ], array( 'new', 'pending' ) ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If there's a previous version and the most current version's status is `new`, we update.
+ if ( ! empty( $this->theme_post->max_version ) && 'new' == $this->theme_post->_status[ $this->theme_post->max_version ] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $ticket_id = (int) $this->theme_post->_ticket_id[ $this->theme_post->max_version ];
</span><span class="cx" style="display: block; padding: 0 10px"> $ticket = $this->trac->ticket_get( $ticket_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectorythemedirectoryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php 2015-02-04 07:50:02 UTC (rev 1218)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php 2015-02-04 18:37:01 UTC (rev 1219)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,18 +20,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Load uploader.
</span><span class="cx" style="display: block; padding: 0 10px"> include_once plugin_dir_path( __FILE__ ) . 'upload.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Things to change on activation.
- */
-function wporg_themes_activate() {
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Give Editors the ability to approve a theme.
- // Can be split to different roles in the future.
- $admin = get_role( 'editor' );
- $admin->add_cap( 'approve_themes' );
-}
-register_activation_hook( __FILE__, 'wporg_themes_activate' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Things to change on deactivation.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -99,16 +88,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wporg_themes_map_meta_cap( $caps, $cap, $user_id, $args ) {
</span><span class="cx" style="display: block; padding: 0 10px"> switch ( $cap ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'approve_theme':
- $caps[] = 'approve_themes';
- unset( $caps[ array_search( $cap, $caps ) ] );
-
- // Don't allow Admins to approve their own themes.
- if ( isset( $args[0] ) && get_post( $args[0] )->post_author == $user_id ) {
- $caps[] = 'do_not_allow';
- }
- break;
-
</del><span class="cx" style="display: block; padding: 0 10px"> case 'delete_categories':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'edit_categories':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'manage_categories':
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -139,81 +118,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'pre_insert_term', 'wporg_themes_pre_insert_term' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Grabs theme review results from Trac and updates theme version number statuses accordingly.
- *
- * We're only checking for new results when on the edit screen for themes, and only for updates since the last time we
- * checked.
- */
-function wporg_themes_sync_review_results() {
- if ( 'repopackage' != $GLOBALS['typenow'] || ! defined( 'THEME_TRACBOT_PASSWORD' ) ) {
- return;
- }
-
- if ( ! class_exists( 'Trac' ) ) {
- require_once ABSPATH . WPINC . '/class-IXR.php';
- require_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
- require_once WPORGPATH . 'bb-theme/themes/lib/class-trac.php';
- }
-
- $trac = new Trac( 'themetracbot', THEME_TRACBOT_PASSWORD, 'https://themes.trac.wordpress.org/login/xmlrpc' );
- $last_request = get_option( 'wporg-themes-last-trac-sync', strtotime( '-2 days' ) );
-
- foreach ( array( 'live', 'not-approved' ) as $resolution ) {
- // Get array of tickets.
- $tickets = (array) $trac->ticket_query( add_query_arg( array(
- 'status' => 'closed',
- 'resolution' => $resolution,
- 'order' => 'changetime',
- 'changetime' => date( 'c', $last_request ),
- 'desc' => 1,
- ) ) );
-
- foreach ( $tickets as $ticket_id ) {
- // Get the theme associated with that ticket.
- $post_ids = get_posts( array(
- 'fields' => 'ids',
- 'meta_query' => array(
- array(
- 'value' => $ticket_id,
- 'compare' => 'IN',
- ),
- ),
- 'post_status' => 'any',
- 'posts_per_page' => - 1,
- 'post_type' => 'repopackage',
- ) );
-
- if ( empty( $post_ids ) ) {
- continue;
- }
-
- $post_id = array_pop( $post_ids );
- $version = array_search( $ticket_id, (array) get_post_meta( $post_id, '_ticket_id', true ) );
- if ( ! $version ) {
- continue;
- }
-
- // Bail if the the theme is not new.
- if ( 'new' != wporg_themes_get_version_status( $post_id, $version ) ) {
- continue;
- }
-
- // Approved themes:
- if ( 'live' == $resolution ) {
- wporg_themes_update_version_status( $post_id, $version, 'pending' );
-
- // Unapproved themes:
- } else {
- wporg_themes_update_version_status( $post_id, $version, 'old' );
- }
- }
- }
-
- update_option( 'wporg-themes-last-trac-sync', time() );
-}
-add_action( 'load-edit.php', 'wporg_themes_sync_review_results' );
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px"> * Returns the status of a theme's version.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $post_id Post ID.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -258,21 +162,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $meta[ $current_version ] = $new_status;
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'pending':
- // Discard all previous pending versions.
- foreach ( array_keys( $meta, $new_status ) as $version ) {
- if ( version_compare( $version, $current_version, '<' ) ) {
- $meta[ $version ] = 'old';
- }
- }
-
- // Mark the current version as pending.
- $meta[ $current_version ] = $new_status;
-
- // Register the pending version.
- update_post_meta( $post_id, '_has_pending_version', $current_version );
- break;
-
</del><span class="cx" style="display: block; padding: 0 10px"> // Marking a version as Old, does not have repercussions on other versions.
</span><span class="cx" style="display: block; padding: 0 10px"> case 'old':
</span><span class="cx" style="display: block; padding: 0 10px"> $meta[ $current_version ] = $new_status;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -302,146 +191,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'post_thumbnail_html', 'wporg_themes_post_thumbnail_html', 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Filters repopackages to only contain themes that are ready to be approved, when on the corresponding view.
- *
- * @param WP_Query $wp_query
- * @return WP_Query
- */
-function wporg_themes_filter_repopackages( $wp_query ) {
- if ( 'edit.php' == $GLOBALS['pagenow'] && 'repopackage' == $GLOBALS['typenow'] && current_user_can( 'approve_theme' ) && ! empty( $_REQUEST['meta_key'] ) && '_has_pending_version' == $_REQUEST['meta_key'] ) {
- $wp_query->set( 'meta_key', '_has_pending_version' );
- }
-
- return $wp_query;
-}
-add_filter( 'pre_get_posts', 'wporg_themes_filter_repopackages' );
-
-/**
- * Adds a view for Themes awaiting approval.
- *
- * @param array $views
- * @return array
- */
-function wporg_themes_status_pending_view( $views ) {
- $total_posts = count( get_posts(array(
- 'fields' => 'ids',
- 'meta_key' => '_has_pending_version',
- 'post_status' => 'any',
- 'posts_per_page' => - 1,
- 'post_type' => 'repopackage',
- ) ) );
-
- if ( current_user_can( 'approve_themes' ) && ! empty( $total_posts ) ) {
- $class = '';
- if ( isset( $_REQUEST['meta_key'] ) && '_has_pending_version' == $_REQUEST['meta_key'] ) {
- $class = ' class="current"';
- }
-
- $views['status_pending'] = "<a href='edit.php?post_type=repopackage&post_status=any&meta_key=_has_pending_version'$class>" . sprintf( _nx( 'Pending Approval <span class="count">(%s)</span>', 'Pending Approval <span class="count">(%s)</span>', $total_posts, 'posts', 'wporg-themes' ), number_format_i18n( $total_posts ) ) . '</a>';
- }
-
- return $views;
-}
-add_filter( 'views_edit-repopackage', 'wporg_themes_status_pending_view' );
-
-/**
- * Adds an action to approve themes.
- *
- * @param array $actions
- * @param WP_Post $post
- * @return array
- */
-function wporg_themes_post_row_actions( $actions, $post ) {
- if ( 'repopackage' == $post->post_type ) {
- $before = array_slice( $actions, 0, - 1, true );
- $after = array_slice( $actions, - 1, 1, true );
-
- if ( current_user_can( 'approve_theme', $post->ID ) && isset( $_REQUEST['meta_key'] ) && '_has_pending_version' == $_REQUEST['meta_key'] ) {
- $before['approve_theme'] = sprintf( '<a class="submit-approve_theme" title="%1$s" href="%2$s">%3$s</a>', esc_attr__( 'Approve this item', 'wporg-themes' ), esc_url( wporg_themes_get_approve_url( $post ) ), __( 'Approve', 'wporg-themes' ) );
- }
-
- $actions = array_merge( $before, $after );
- }
-
- return $actions;
-}
-add_filter( 'post_row_actions', 'wporg_themes_post_row_actions', 10, 2 );
-
-/**
- * Action link to approve a theme version.
- *
- * @param WP_Post $post
- * @return string URL
- */
-function wporg_themes_get_approve_url( $post ) {
- return wp_nonce_url( add_query_arg( 'action', 'approve', admin_url( sprintf( get_post_type_object( $post->post_type )->_edit_link, $post->ID ) ) ), "approve-post_{$post->ID}" );
-}
-
-/**
- * Approve a theme version.
- */
-function wporg_themes_approve_theme() {
- if ( isset( $_GET['post'] ) ) {
- $post_id = (int) $_GET['post'];
- }
-
- if ( ! $post_id ) {
- wp_redirect( admin_url( 'edit.php' ) );
- exit();
- }
-
- check_admin_referer( 'approve-post_' . $post_id );
-
- $version = get_post_meta( $post_id, '_has_pending_version', true );
-
- if ( ! $version ) {
- wp_die( __( 'This item has already been approved.', 'wporg-themes' ) );
- }
-
- $post = get_post( $post_id );
-
- if ( ! get_post_type_object( $post->post_type ) ) {
- wp_die( __( 'Unknown post type.' ) );
- }
-
- if ( ! current_user_can( 'approve_theme', $post_id ) || 'repopackage' != $post->post_type ) {
- wp_die( __( 'You are not allowed to approve this item.', 'wporg-themes' ) );
- }
-
- wporg_themes_update_version_status( $post_id, $version, 'live' );
- delete_post_meta( $post_id, '_has_pending_version' );
-
- $ticket_id = get_post_meta( $post_id, '_trac_ticket_' . $version, true );
- if ( 'publish' == $post->post_status ) {
- $email_subject = sprintf( __( '[WordPress Themes] %1$s %2$s is now live', 'wporg-themes' ), $post->post_title, $version );
- $email_content = sprintf( __( 'Version %1$s of %2$s is now live at https://wordpress.org/themes/%3$s.', 'wporg-themes' ), $version, $post->post_title, $post->post_name ) . "\n\n";
- $email_content .= sprintf( __( 'Any feedback items are at %s.', 'wporg-themes' ), "https://themes.trac.wordpress.org/ticket/$ticket_id" ) . "\n\n--\n";
- $email_content .= __( 'The WordPress.org Themes Team', 'wporg' ) . "\n";
- $email_content .= 'theme-reviewers@lists.wordpress.org';
-
- } else {
- $email_subject = sprintf( __( '[WordPress Themes] %s has been approved!', 'wporg-themes' ), $post->post_title );
- $email_content = sprintf( __( 'Congratulations, your new theme %1$s is now available to the public at https://wordpress.org/themes/%2$s.', 'wporg-themes' ), $post->post_title, $post->post_name ) . "\n\n";
- $email_content .= sprintf( __( 'Any feedback items are at %s.', 'wporg-themes' ), "https://themes.trac.wordpress.org/ticket/$ticket_id" ) . "\n\n--\n";
- $email_content .= __( 'The WordPress.org Themes Team', 'wporg' ) . "\n";
- $email_content .= 'theme-reviewers@lists.wordpress.org';
- }
-
- wp_mail( get_user_by( 'id', $post->post_author )->user_email, $email_subject, $email_content, 'From: theme-reviewers@lists.wordpress.org' );
-
-
- // Update the theme's post status.
- wp_update_post( array(
- 'ID' => $post_id,
- 'post_status' => 'publish',
- ) );
-
- wp_redirect( add_query_arg( 'approved', 1, remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), wp_get_referer() ) ) );
- exit();
-}
-add_filter( 'admin_action_approve', 'wporg_themes_approve_theme' );
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px"> * Prevents repopackages from being deleted.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $post_id
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -456,21 +205,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'before_delete_post', 'wporg_theme_no_delete_repopackage' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Give the user feedback after approving a theme.
- */
-function wporg_themes_admin_notices() {
- if ( ! empty( $_GET['approved'] ) ) {
- $approved = absint( $_GET['approved'] );
- $message = _n( '%s theme approved.', '%s themes approved.', $approved );
- add_settings_error( 'wporg_themes', 'approved', sprintf( $message, $approved ), 'updated' );
- }
-
- // Display admin notices, if any.
- settings_errors( 'wporg_themes' );
-}
-add_filter( 'admin_notices', 'wporg_themes_admin_notices' );
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px"> * Better view in the Packages screen.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $columns
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -550,7 +284,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <select name="wporg_themes_status[<?php echo base64_encode( $version ); // base64 because version numbers don't work so well as parts of keys ?>]">
</span><span class="cx" style="display: block; padding: 0 10px"> <option value="new" <?php selected( $status, 'new' ); ?>><?php esc_html_e( 'New', 'wporg-themes' ); ?></option>
</span><span class="cx" style="display: block; padding: 0 10px"> <option value="live" <?php selected( $status, 'live' ); ?>><?php esc_html_e( 'Live', 'wporg-themes' ); ?></option>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <option value="pending" <?php selected( $status, 'pending' ); ?>><?php esc_html_e( 'Pending', 'wporg-themes' ); ?></option>
</del><span class="cx" style="display: block; padding: 0 10px"> <option value="old" <?php selected( $status, 'old' ); ?>><?php esc_html_e( 'Old', 'wporg-themes' ); ?></option>
</span><span class="cx" style="display: block; padding: 0 10px"> </select>
</span><span class="cx" style="display: block; padding: 0 10px"> </p>
</span></span></pre>
</div>
</div>
</body>
</html>