Skip to content

Commit

Permalink
Add updated notice
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Dec 30, 2022
1 parent 0bb66f1 commit 8de7350
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions includes/class-automatic-status.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ public function process_settings() {
} else {
update_option( 'friends_automatic_status_disabled', 1 );
}

if ( isset( $_GET['_wp_http_referer'] ) ) {
wp_safe_redirect( wp_get_referer() );
} else {
wp_safe_redirect( add_query_arg( 'updated', '1', remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
}
}

/**
Expand Down Expand Up @@ -233,6 +239,16 @@ function( $actions, $post ) {
'title' => __( 'Friends', 'friends' ),
)
);

if ( isset( $_GET['updated'] ) ) {
?>
<div id="message" class="updated notice is-dismissible"><p><?php esc_html_e( 'Settings were updated.', 'friends' ); ?></p></div>
<?php
} elseif ( isset( $_GET['error'] ) ) {
?>
<div id="message" class="updated error is-dismissible"><p><?php esc_html_e( 'An error occurred.', 'friends' ); ?></p></div>
<?php
}
Friends::template_loader()->get_template_part( 'admin/automatic-status-list-table', false, compact( 'wp_list_table', 'post_type' ) );
Friends::template_loader()->get_template_part( 'admin/settings-footer' );
}
Expand Down

0 comments on commit 8de7350

Please sign in to comment.