diff --git a/includes/admin/settings.php b/includes/admin/settings.php index 9227c33..3135452 100644 --- a/includes/admin/settings.php +++ b/includes/admin/settings.php @@ -2,10 +2,22 @@ namespace pterotype\settings; function register_settings_sections() { + \register_setting( 'pterotype_settings', 'pterotype_blog_name', array( + 'type' => 'string', + 'description' => __( "The site's name in the Fediverse", 'pterotype' ), + 'show_in_rest' => true, + ) ); + \register_setting( 'pterotype_settings', 'pterotype_blog_description', array( + 'type' => 'string', + 'description' => __( "The site's description in the Fediverse", 'pterotype' ), + 'show_in_rest' => true, + ) ); \add_settings_section( 'pterotype_identity', 'Fediverse Identity', - '', + function() { + ?>

These settings determine how your blog will look in other Fediverse apps

- + + + diff --git a/includes/init.php b/includes/init.php index f2e8c77..718ee56 100644 --- a/includes/init.php +++ b/includes/init.php @@ -81,6 +81,14 @@ add_action( "update_option_theme_mods_$theme", function() { \pterotype\identity\update_identity( PTEROTYPE_BLOG_ACTOR_SLUG ); } ); +add_action( 'update_option_pterotype_blog_name', function() { + \pterotype\identity\update_identity( PTEROTYPE_BLOG_ACTOR_SLUG ); +} ); + +add_action( 'update_option_pterotype_blog_description', function() { + \pterotype\identity\update_identity( PTEROTYPE_BLOG_ACTOR_SLUG ); +} ); + add_action( 'admin_menu', function() { \pterotype\admin\register_admin_page(); \pterotype\settings\register_settings_sections(); diff --git a/includes/server/actors.php b/includes/server/actors.php index 3a7924b..89babf7 100644 --- a/includes/server/actors.php +++ b/includes/server/actors.php @@ -3,6 +3,7 @@ namespace pterotype\actors; require_once plugin_dir_path( __FILE__ ) . '../pgp.php'; require_once plugin_dir_path( __FILE__ ) . 'objects.php'; +require_once plugin_dir_path( __FILE__ ) . '../admin/settings.php'; function get_actor( $id ) { global $wpdb; @@ -153,10 +154,10 @@ function get_blog_actor() { 'outbox' => get_rest_url( null, sprintf( '/pterotype/v1/actor/%s/outbox', PTEROTYPE_BLOG_ACTOR_SLUG ) ), - 'name' => get_bloginfo( 'name' ), + 'name' => \pterotype\settings\get_blog_name_value(), // TODO in the future, make this configurable, both here and in the Webfinger handler 'preferredUsername' => PTEROTYPE_BLOG_ACTOR_USERNAME, - 'summary' => get_bloginfo( 'description' ), + 'summary' => \pterotype\settings\get_blog_description_value(), 'url' => network_site_url( '/' ), 'publicKey' => array( 'id' => get_rest_url(