Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
Correcting an old bug fixed in Issue #2
Browse files Browse the repository at this point in the history
  • Loading branch information
jwcounts committed Feb 2, 2022
1 parent aa5873e commit 737f79a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions push_story.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ function nprstory_api_push( $post_ID, $post ) {
* @param unknown_type $post_ID
*/
function nprstory_api_delete( $post_ID ) {
if ( !current_user_can( 'delete_others_posts' ) ) {
wp_die(
__('You do not have permission to delete posts in the NPR API. Users that can delete other users\' posts have that ability: administrators and editors.'),
__('NPR Story API Error'),
403
);
}

$push_post_type = get_option( 'ds_npr_push_post_type' );
if ( empty( $push_post_type ) ) {
$push_post_type = 'post';
Expand All @@ -106,6 +98,13 @@ function nprstory_api_delete( $post_ID ) {
//if the push url isn't set, don't even try to delete.
$push_url = get_option( 'ds_npr_api_push_url' );
if ( $post->post_type == $push_post_type && !empty( $push_url ) && !empty( $api_id ) ) {
if ( !current_user_can( 'delete_others_posts' ) ) {
wp_die(
__('You do not have permission to delete posts in the NPR API. Users that can delete other users\' posts have that ability: administrators and editors.'),
__('NPR Story API Error'),
403
);
}
// For now, only submit regular posts, and only on publish.
if ( $post->post_type != 'post' || $post->post_status != 'publish' ) {
return;
Expand Down

0 comments on commit 737f79a

Please sign in to comment.