Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cron to update post_status #1274

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ public function enforce_post_status( $post_data, $post_data_raw ) {
$wcpt = get_post_type_object( WCPT_POST_TYPE_ID );

// Only WordCamp Wranglers can change WordCamp statuses.
if ( ! current_user_can( 'wordcamp_wrangle_wordcamps' ) ) {
if ( is_user_logged_in() && ! current_user_can( 'wordcamp_wrangle_wordcamps' ) ) {
$post_data['post_status'] = $post->post_status;
}

Expand Down Expand Up @@ -865,7 +865,7 @@ public function require_complete_meta_to_publish_wordcamp( $post_data, $post_dat
foreach ( $required_needs_site_fields as $field ) {

// phpcs:ignore WordPress.Security.NonceVerification.Missing -- nonce check would have done in `metabox_save`.
$value = $_POST[ wcpt_key_to_str( $field, 'wcpt_' ) ];
$value = $_POST[ wcpt_key_to_str( $field, 'wcpt_' ) ] ?? '';

if ( empty( $value ) || 'null' == $value ) {
$post_data['post_status'] = 'wcpt-needs-email';
Expand All @@ -879,7 +879,7 @@ public function require_complete_meta_to_publish_wordcamp( $post_data, $post_dat
if ( 'wcpt-scheduled' == $post_data['post_status'] && isset( $post_data_raw['ID'] ) && absint( $post_data_raw['ID'] ) > $min_site_id ) {
foreach ( $required_scheduled_fields as $field ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- nonce check would have done in `metabox_save`.
$value = $_POST[ wcpt_key_to_str( $field, 'wcpt_' ) ];
$value = $_POST[ wcpt_key_to_str( $field, 'wcpt_' ) ] ?? '';

if ( empty( $value ) || 'null' == $value ) {
$post_data['post_status'] = 'wcpt-needs-schedule';
Expand Down
Loading