-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): merge in release v2.3.4
- Loading branch information
Showing
6 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
includes/distributor-customizations/class-force-author-byline.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Newspack Distributor Force Author byline option. | ||
* | ||
* @package Newspack | ||
*/ | ||
|
||
namespace Newspack_Network\Distributor_Customizations; | ||
|
||
/** | ||
* Class to enforce that the "Override Author Byline" option is always disabled. | ||
*/ | ||
class Force_Author_Byline { | ||
|
||
/** | ||
* Initialize hooks | ||
*/ | ||
public static function init() { | ||
add_filter( 'option_dt_settings', [ __CLASS__, 'filter_dt_settings' ] ); | ||
add_filter( 'default_option_dt_settings', [ __CLASS__, 'filter_dt_settings' ] ); | ||
add_action( 'admin_init', [ __CLASS__, 'remove_setting' ], 11 ); | ||
} | ||
|
||
/** | ||
* Filter the Distributor settings to ensure that the "Override Author Byline" option is always disabled. | ||
* | ||
* @param array $settings The Distributor settings. | ||
*/ | ||
public static function filter_dt_settings( $settings ) { | ||
if ( ! is_array( $settings ) ) { | ||
$settings = []; | ||
} | ||
$settings['override_author_byline'] = false; | ||
return $settings; | ||
} | ||
|
||
/** | ||
* Remove the "Override Author Byline" setting from the Distributor settings page. | ||
*/ | ||
public static function remove_setting() { | ||
global $wp_settings_fields; | ||
|
||
if ( | ||
isset( $wp_settings_fields['distributor'] ) && | ||
isset( $wp_settings_fields['distributor']['dt-section-1'] ) && | ||
isset( $wp_settings_fields['distributor']['dt-section-1']['override_author_byline'] ) | ||
) { | ||
unset( $wp_settings_fields['distributor']['dt-section-1']['override_author_byline'] ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters