diff --git a/packages/block-library/src/loginout/edit.js b/packages/block-library/src/loginout/edit.js index 9b8699b67bebcd..df5b0d377f9606 100644 --- a/packages/block-library/src/loginout/edit.js +++ b/packages/block-library/src/loginout/edit.js @@ -6,7 +6,7 @@ import { __ } from '@wordpress/i18n'; import { InspectorControls, useBlockProps } from '@wordpress/block-editor'; import ServerSideRender from '@wordpress/server-side-render'; -export default function ArchivesEdit( { attributes, setAttributes } ) { +export default function LoginOutEdit( { attributes, setAttributes } ) { const { displayLoginAsForm, redirectToCurrent } = attributes; return ( diff --git a/packages/block-library/src/loginout/index.php b/packages/block-library/src/loginout/index.php index 5369136ec65115..e7b0ae7cd53b73 100644 --- a/packages/block-library/src/loginout/index.php +++ b/packages/block-library/src/loginout/index.php @@ -19,17 +19,15 @@ function render_block_core_loginout( $attributes ) { ? get_permalink( get_the_ID() ) : ''; - // Build the classes for this block. - $classes = 'wp-block-loginout'; - $classes .= is_user_logged_in() ? ' logged-in' : ' logged-out'; - if ( ! empty( $attributes['displayLoginAsForm'] ) ) { - $classes .= ' has-login-form'; - } + $classes = is_user_logged_in() ? 'logged-in' : 'logged-out'; + $contents = wp_loginout( $redirect_url, false ); - $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); - $contents = wp_loginout( $redirect_url, false ); // If logged-out and displayLoginAsForm is true, show the login form. if ( ! is_user_logged_in() && ! empty( $attributes['displayLoginAsForm'] ) ) { + // Add a class. + $classes .= ' has-login-form'; + + // Get the form. $contents = wp_login_form( array( 'echo' => false, @@ -38,6 +36,8 @@ function render_block_core_loginout( $attributes ) { ); } + $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); + return '