<!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>[2804] sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt: WordCamp Post Type: Add and enforce new statuses for WordCamps.</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/2804">2804</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/2804","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>kovshenin</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-03-25 12:55:36 +0000 (Fri, 25 Mar 2016)</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'>WordCamp Post Type: Add and enforce new statuses for WordCamps.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitesbranchesapplicationtrackingwordcamporgpublic_htmlwpcontentpluginswcptwcptwordcampwordcampadminphp">sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php</a></li>
<li><a href="#sitesbranchesapplicationtrackingwordcamporgpublic_htmlwpcontentpluginswcptwcptwordcampwordcamploaderphp">sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-loader.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/views/wordcamp/</li>
<li><a href="#sitesbranchesapplicationtrackingwordcamporgpublic_htmlwpcontentpluginswcptviewswordcampmetaboxstatusphp">sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/views/wordcamp/metabox-status.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitesbranchesapplicationtrackingwordcamporgpublic_htmlwpcontentpluginswcptviewswordcampmetaboxstatusphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/views/wordcamp/metabox-status.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/views/wordcamp/metabox-status.php (rev 0)
+++ sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/views/wordcamp/metabox-status.php 2016-03-25 12:55:36 UTC (rev 2804)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,45 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php defined( 'WPINC' ) or die(); ?>
+
+<div id="submitpost" class="wcb submitbox">
+ <div id="minor-publishing">
+ <div id="misc-publishing-actions">
+ <div class="misc-pub-section misc-pub-post-status">
+ <label>
+ WordCamp Status
+
+ <span id="post-status-display">
+ <select name="post_status">
+ <?php foreach ( WordCamp_Loader::get_post_statuses() as $key => $label ) : ?>
+ <?php $status = get_post_status_object( $key ); ?>
+ <option value="<?php echo esc_attr( $status->name ); ?>" <?php selected( $post->post_status, $status->name ); ?> >
+ <?php echo esc_html( $status->label ); ?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+ </span>
+ </label>
+ </div>
+ <div class="clear"></div>
+ </div> <!-- #misc-publishing-actions -->
+
+ <div class="clear"></div>
+ </div> <!-- #minor-publishing -->
+
+
+ <div id="major-publishing-actions">
+ <div id="delete-action">
+ <?php if ( current_user_can( 'delete_post', $post->ID ) ) : ?>
+ <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>">
+ <?php _e( 'Delete', 'wordcamporg' ); ?>
+ </a>
+ <?php endif; ?>
+ </div>
+
+ <div id="publishing-action">
+ <?php submit_button( 'Update', 'primary button-large', 'wcpt-update', false, array( 'accesskey' => 'p' ) ); ?>
+ </div>
+
+ <div class="clear"></div>
+ </div> <!-- #major-publishing-actions -->
+
+</div> <!-- .submitbox -->
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="sitesbranchesapplicationtrackingwordcamporgpublic_htmlwpcontentpluginswcptwcptwordcampwordcampadminphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php 2016-03-25 10:56:40 UTC (rev 2803)
+++ sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php 2016-03-25 12:55:36 UTC (rev 2804)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,11 +14,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $active_admin_notices;
</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">- * wcpt_admin ()
- *
</del><span class="cx" style="display: block; padding: 0 10px"> * Initialize WCPT Admin
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function WordCamp_Admin () {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function __construct() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->active_admin_notices = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Add some general styling to the admin area
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -26,14 +24,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Forum column headers.
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'manage_' . WCPT_POST_TYPE_ID . '_posts_columns', array( $this, 'column_headers' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'display_post_states', array( $this, 'display_post_states' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Forum columns (in page row)
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'manage_posts_custom_column', array( $this, 'column_data' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'post_row_actions', array( $this, 'post_row_actions' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Topic metabox actions
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_action( 'admin_menu', array( $this, 'metabox' ) );
- add_action( 'save_post', array( $this, 'metabox_save' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_action( 'add_meta_boxes', array( $this, 'metabox' ) );
+ add_action( 'save_post', array( $this, 'metabox_save' ), 10, 2 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Scripts and CSS
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -101,7 +100,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'advanced',
</span><span class="cx" style="display: block; padding: 0 10px"> 'high'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> add_meta_box(
</span><span class="cx" style="display: block; padding: 0 10px"> 'wcpt_notes',
</span><span class="cx" style="display: block; padding: 0 10px"> __( 'Add a Note', 'wordcamporg' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -119,6 +118,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'advanced',
</span><span class="cx" style="display: block; padding: 0 10px"> 'low'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Remove core's submitdiv.
+ remove_meta_box( 'submitdiv', WCPT_POST_TYPE_ID, 'side' );
+
+ $statuses = WordCamp_Loader::get_post_statuses();
+
+ add_meta_box( 'submitdiv', __( 'Status', 'wordcamporg' ), array( $this, 'metabox_status' ),
+ WCPT_POST_TYPE_ID, 'side', 'high' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -129,7 +136,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $post_id
</span><span class="cx" style="display: block; padding: 0 10px"> * @return int
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function metabox_save( $post_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function metabox_save( $post_id, $post ) {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Don't add/remove meta on revisions and auto-saves
</span><span class="cx" style="display: block; padding: 0 10px"> if ( wp_is_post_autosave( $post_id ) || wp_is_post_revision( $post_id ) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -513,6 +520,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Display the status of a WordCamp post
+ *
+ * @param array $states
+ *
+ * @return array
+ */
+ public function display_post_states( $states ) {
+ global $post;
+
+ if ( $post->post_type != WCPT_POST_TYPE_ID ) {
+ return $states;
+ }
+
+ $status = get_post_status_object( $post->post_status );
+ if ( get_query_var( 'post_status' ) != $post->post_status ) {
+ $states[ $status->name ] = $status->label;
+ }
+
+ return $states;
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * column_data ( $column, $post_id )
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Print extra columns
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -664,18 +693,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Force WordCamp posts to go through the expected status progression.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * They should start as drafts, then move to pending, and then be published. This is necessary because
- * many automated processes (e.g., Organizer Reminder emails) are triggered when the post moves from
- * one status to another, and deviations from the expected progression can cause bugs.
- *
- * Posts should still be allowed to move backwards in the progression, though.
- *
</del><span class="cx" style="display: block; padding: 0 10px"> * @param array $post_data
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $post_data_raw
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function enforce_post_status_progression( $post_data, $post_data_raw ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( WCPT_POST_TYPE_ID == $post_data['post_type'] && ! empty( $_POST ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $post_data['post_type'] != WCPT_POST_TYPE_ID ) {
+ return $post_data;
+ }
+
+ // @todo: Rewrite all of this according to the new flow.
+ if ( ! empty( $_POST ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $previous_post_status = get_post( absint( $_POST['post_ID'] ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $previous_post_status = $previous_post_status->post_status;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -690,6 +718,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Enforce a valid status.
+ $statuses = array_keys( WordCamp_Loader::get_post_statuses() );
+ if ( ! in_array( $post_data['post_status'], $statuses ) ) {
+ $post_data['post_status'] = $statuses[0];
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $post_data;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -868,6 +902,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Render the WordCamp status meta box.
+ */
+ public function metabox_status( $post ) {
+ wp_nonce_field( 'status-' . $post->ID, 'status_nonce' );
+ require_once( WCPT_DIR . 'views/wordcamp/metabox-status.php' );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> endif; // class_exists check
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -966,7 +1008,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( ! empty( $messages[ $key ] ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( 'textarea' == $value ) { echo '<br />'; } ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> <span class="description"><?php echo esc_html( $messages[ $key ] ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </p>
</span></span></pre></div>
<a id="sitesbranchesapplicationtrackingwordcamporgpublic_htmlwpcontentpluginswcptwcptwordcampwordcamploaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-loader.php 2016-03-25 10:56:40 UTC (rev 2803)
+++ sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-loader.php 2016-03-25 12:55:36 UTC (rev 2804)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,7 +19,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function __construct() {
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'plugins_loaded', array( $this, 'includes' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_action( 'init', array ( $this, 'register_post_types' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ add_action( 'init', array( $this, 'register_post_types' ) );
+ add_action( 'init', array( $this, 'register_post_statuses' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,7 +51,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @todo Finish up the post type admin area with messages, columns, etc...*
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function register_post_types () {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function register_post_types() {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // WordCamp post type labels
</span><span class="cx" style="display: block; padding: 0 10px"> $wcpt_labels = array (
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,24 +86,54 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Register WordCamp post type
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- register_post_type (
- WCPT_POST_TYPE_ID,
- apply_filters( 'wcpt_register_post_type',
- array (
- 'labels' => $wcpt_labels,
- 'rewrite' => $wcpt_rewrite,
- 'supports' => $wcpt_supports,
- 'menu_position' => '100',
- 'public' => true,
- 'show_ui' => true,
- 'can_export' => true,
- 'capability_type' => 'post',
- 'hierarchical' => false,
- 'has_archive' => true,
- 'query_var' => true,
- 'menu_icon' => 'dashicons-wordpress',
- )
- )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ register_post_type( WCPT_POST_TYPE_ID, array(
+ 'labels' => $wcpt_labels,
+ 'rewrite' => $wcpt_rewrite,
+ 'supports' => $wcpt_supports,
+ 'menu_position' => '100',
+ 'public' => true,
+ 'show_ui' => true,
+ 'can_export' => true,
+ 'capability_type' => 'post',
+ 'hierarchical' => false,
+ 'has_archive' => true,
+ 'query_var' => true,
+ 'menu_icon' => 'dashicons-wordpress',
+ ) );
+ }
+
+ public function register_post_statuses() {
+ foreach ( self::get_post_statuses() as $key => $label ) {
+ register_post_status( $key, array(
+ 'label' => $label,
+ 'public' => true,
+ 'label_count' => _nx_noop(
+ sprintf( '%s <span class="count">(%s)</span>', $label, '%s' ),
+ sprintf( '%s <span class="count">(%s)</span>', $label, '%s' ),
+ 'wordcamporg'
+ ),
+ ) );
+ }
+ }
+
+ public static function get_post_statuses() {
+ return array(
+ 'wcpt-formal-review' => _x( 'Formal Review', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-inactive' => _x( 'Inactive', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-application-review' => _x( 'Application Review', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-scheduling' => _x( 'Scheduling', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-interview-scheduled' => _x( 'Interview Scheduled', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-needs-site' => _x( 'Needs Site', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-rejected' => _x( 'Rejected', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-agreement-signed' => _x( 'Organizer Agreement Signed', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-site-created' => _x( 'Site Created', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-listing-added' => _x( 'Listing Added to Pending', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-needs-budget-review' => _x( 'Needs Budget Review', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-budget-approved' => _x( 'Budget Approved', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-venue-signed' => _x( 'Venue Contract Signed', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-scheduled' => _x( 'Scheduled', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-debrief' => _x( 'Debriefed', 'wordcamp status', 'wordcamporg' ),
+ 'wcpt-budget-closed' => _x( 'Budget Closed', 'wordcamp status', 'wordcamporg' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>