diff --git a/includes/model/class-blog-user.php b/includes/model/class-blog-user.php index d1413dc..4cf41f9 100644 --- a/includes/model/class-blog-user.php +++ b/includes/model/class-blog-user.php @@ -75,19 +75,12 @@ class Blog_User extends User { * @return string The auto-generated Username. */ public static function get_default_username() { - $username = \get_option( 'activitypub_blog_user_identifier' ); - - if ( $username ) { - return $username; - } - // check if domain host has a subdomain $host = \wp_parse_url( \get_home_url(), \PHP_URL_HOST ); $host = \preg_replace( '/^www\./i', '', $host ); $host_parts = \explode( '.', $host ); if ( \count( $host_parts ) <= 2 && strlen( $host ) <= 15 ) { - \update_option( 'activitypub_blog_user_identifier', $host ); return $host; } @@ -96,7 +89,6 @@ class Blog_User extends User { $blog_title = \sanitize_title( $blog_title ); if ( strlen( $blog_title ) <= 15 ) { - \update_option( 'activitypub_blog_user_identifier', $blog_title ); return $blog_title; } @@ -111,12 +103,17 @@ class Blog_User extends User { // get random item of $default_identifier $default = $default_identifier[ \array_rand( $default_identifier ) ]; - \update_option( 'activitypub_blog_user_identifier', $default ); return $default; } public function get_preferred_username() { + $username = \get_option( 'activitypub_blog_user_identifier' ); + + if ( $username ) { + return $username; + } + return self::get_default_username(); } diff --git a/templates/settings.php b/templates/settings.php index b587b9e..3da7eaf 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -31,7 +31,7 @@
- +

@@ -58,7 +58,7 @@ - +