Update co-authored IDs helper name, add filter
This commit is contained in:
parent
1fd26e2d0b
commit
fda42d7e0f
@ -807,6 +807,15 @@ Filters the form fields of the `fictioneer_contact_form` shortcode.
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_co_authored_ids', $story_ids, $author_id )`
|
||||
Filters the array of story IDs co-authored by the specified author ID, as queried and returned by the `fictioneer_sql_get_co_authored_story_ids()` function. These IDs are used to query selectable story chapters and validate permissions for chapter assignment and appending.
|
||||
|
||||
**Parameters:**
|
||||
* $story_ids (int[]) – Array of story IDs.
|
||||
* $author_id (int) – Co-author ID.
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_customizer_{theme_option}', $choices )`
|
||||
Filters the choices arrays of select theme options. Combined with the `fictioneer_filter_pre_build_customize_css` filter, you can append own options and the requires styles. Available options: `header_image_style`, `header_style`, `page_style`, `story_cover_position`, `card_frame`, `card_image_style`, `card_style` (actually card footer), `card_shadow`, `content_list_style`, and `footer_style`.
|
||||
|
||||
|
@ -710,7 +710,7 @@ if ( ! function_exists( 'fictioneer_sql_has_new_story_chapters' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'fictioneer_get_co_authored_story_ids' ) ) {
|
||||
if ( ! function_exists( 'fictioneer_sql_get_co_authored_story_ids' ) ) {
|
||||
/**
|
||||
* Returns story IDs where the user is a co-author
|
||||
*
|
||||
@ -723,7 +723,7 @@ if ( ! function_exists( 'fictioneer_get_co_authored_story_ids' ) ) {
|
||||
* @return int[] Array of story IDs.
|
||||
*/
|
||||
|
||||
function fictioneer_get_co_authored_story_ids( $author_id ) {
|
||||
function fictioneer_sql_get_co_authored_story_ids( $author_id ) {
|
||||
static $cache = [];
|
||||
|
||||
if ( isset( $cache[ $author_id ] ) ) {
|
||||
@ -742,6 +742,8 @@ if ( ! function_exists( 'fictioneer_get_co_authored_story_ids' ) ) {
|
||||
)
|
||||
);
|
||||
|
||||
$story_ids = apply_filters( 'fictioneer_filter_co_authored_ids', $story_ids, $author_id );
|
||||
|
||||
$cache[ $author_id ] = $story_ids;
|
||||
|
||||
return $story_ids;
|
||||
@ -784,7 +786,7 @@ if ( ! function_exists( 'fictioneer_sql_get_chapter_story_selection' ) ) {
|
||||
$sql .= " AND p.post_author = %d";
|
||||
$values[] = $post_author_id;
|
||||
|
||||
$co_authored_stories = fictioneer_get_co_authored_story_ids( $post_author_id );
|
||||
$co_authored_stories = fictioneer_sql_get_co_authored_story_ids( $post_author_id );
|
||||
|
||||
if ( ! empty( $co_authored_stories ) ) {
|
||||
$placeholders = implode( ',', array_fill( 0, count( $co_authored_stories ), '%d' ) );
|
||||
|
@ -2951,7 +2951,7 @@ function fictioneer_save_chapter_metaboxes( $post_id ) {
|
||||
$invalid_story = false;
|
||||
|
||||
if ( get_option( 'fictioneer_limit_chapter_stories_by_author' ) ) {
|
||||
$co_authored_stories = fictioneer_get_co_authored_story_ids( $post_author_id );
|
||||
$co_authored_stories = fictioneer_sql_get_co_authored_story_ids( $post_author_id );
|
||||
|
||||
$invalid_story = $story_author_id != $post_author_id && ! in_array( $story_id, $co_authored_stories );
|
||||
}
|
||||
|
@ -1590,7 +1590,7 @@ function fictioneer_append_chapter_to_story( $post_id, $story_id, $force = false
|
||||
// Setup, continued
|
||||
$chapter_author_id = get_post_field( 'post_author', $post_id );
|
||||
$story_author_id = get_post_field( 'post_author', $story_id );
|
||||
$co_authored_story_ids = fictioneer_get_co_authored_story_ids( $chapter_author_id );
|
||||
$co_authored_story_ids = fictioneer_sql_get_co_authored_story_ids( $chapter_author_id );
|
||||
|
||||
// Abort if the author IDs do not match
|
||||
if (
|
||||
|
Loading…
x
Reference in New Issue
Block a user