Cover private to draft chapter update

This commit is contained in:
Tetrakern 2023-11-09 10:52:03 +01:00
parent 7e3ef28577
commit f10b376f91
2 changed files with 10 additions and 6 deletions

View File

@ -241,7 +241,8 @@ Fictioneer customizes WordPress by using as many standard action and filter hook
| `manage_comments_custom_column` | `fictioneer_add_comments_report_column_content`
| `personal_options_update` | `fictioneer_update_admin_user_profile`, `fictioneer_update_my_user_profile`
| `pre_get_posts` | `fictioneer_extend_search_query`, `fictioneer_remove_unlisted_from_search`, `fictioneer_read_others_files`, `fictioneer_read_others_files_list_view`, `fictioneer_filter_chapters_by_story`
| `publish_to_draft` | `fictioneer_chapter_publish_to_draft`
| `private_to_draft` | `fictioneer_chapter_to_draft`
| `publish_to_draft` | `fictioneer_chapter_to_draft`
| `rest_api_init` | `fictioneer_register_endpoint_get_story_comments`
| `restrict_manage_posts` | `fictioneer_add_chapter_story_filter_dropdown`
| `save_post` | `fictioneer_create_sitemap`, `fictioneer_refresh_chapters_schema`, `fictioneer_refresh_chapter_schema`, `fictioneer_refresh_collections_schema`, `fictioneer_refresh_post_caches`, `fictioneer_refresh_post_schema`, `fictioneer_refresh_recommendations_schema`, `fictioneer_refresh_recommendation_schema`, `fictioneer_refresh_stories_schema`, `fictioneer_refresh_story_schema`, `fictioneer_save_seo_metabox`, `fictioneer_save_word_count`, `fictioneer_track_chapter_and_story_updates`, `fictioneer_update_modified_date_on_story_for_chapter`, `fictioneer_update_shortcode_relationships`, `fictioneer_purge_transients`, `fictioneer_post_story_to_discord`, `fictioneer_post_chapter_to_discord`, `fictioneer_save_story_metaboxes`, `fictioneer_save_chapter_metaboxes`, `fictioneer_save_advanced_metabox`, `fictioneer_save_support_links_metabox`, `fictioneer_save_collection_metaboxes`, `fictioneer_save_recommendation_metaboxes`, `fictioneer_save_post_metaboxes`

View File

@ -131,6 +131,8 @@ function fictioneer_get_story_changelog( $story_id ) {
time(),
_x( 'Initialized.', 'Story changelog initialized.', 'fictioneer' )
);
update_post_meta( $story_id, 'fictioneer_story_changelog', $changelog );
}
// Return
@ -219,7 +221,7 @@ function fictioneer_log_story_chapter_status_changes( $new_status, $old_status,
return;
}
// Log
// Setup
$changelog = fictioneer_get_story_changelog( $story_id );
// Add filters
@ -286,7 +288,7 @@ function fictioneer_remove_chapter_from_story( $chapter_id ) {
return;
}
// Chapter list?
// Check chapter list
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $story_id );
$previous = fictioneer_get_field( 'fictioneer_story_chapters', $story_id );
@ -312,14 +314,14 @@ function fictioneer_remove_chapter_from_story( $chapter_id ) {
add_action( 'trashed_post', 'fictioneer_remove_chapter_from_story' );
/**
* Removes chapter from story when unpublished
* Wrapper for actions when a chapter is set to draft
*
* @since Fictioneer 5.7.5
*
* @param WP_Post $post The post object.
*/
function fictioneer_chapter_publish_to_draft( $post ) {
function fictioneer_chapter_to_draft( $post ) {
// Chapter?
if ( $post->post_type !== 'fcn_chapter' ) {
return;
@ -334,6 +336,7 @@ function fictioneer_chapter_publish_to_draft( $post ) {
// Add filter
add_filter( 'fictioneer_filter_safe_title', 'fictioneer_prefix_draft_safe_title', 10, 2 );
}
add_action( 'publish_to_draft', 'fictioneer_chapter_publish_to_draft' );
add_action( 'publish_to_draft', 'fictioneer_chapter_to_draft' );
add_action( 'private_to_draft', 'fictioneer_chapter_to_draft' );
?>