Edit File by line
/home/zeestwma/richards.../wp-inclu.../blocks
File: loginout.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/loginout` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/loginout` block on server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 5.8.0
[10] Fix | Delete
*
[11] Fix | Delete
* @param array $attributes The block attributes.
[12] Fix | Delete
*
[13] Fix | Delete
* @return string Returns the login-out link or form.
[14] Fix | Delete
*/
[15] Fix | Delete
function render_block_core_loginout( $attributes ) {
[16] Fix | Delete
[17] Fix | Delete
// Build the redirect URL.
[18] Fix | Delete
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
[19] Fix | Delete
[20] Fix | Delete
$classes = is_user_logged_in() ? 'logged-in' : 'logged-out';
[21] Fix | Delete
$contents = wp_loginout(
[22] Fix | Delete
isset( $attributes['redirectToCurrent'] ) && $attributes['redirectToCurrent'] ? $current_url : '',
[23] Fix | Delete
false
[24] Fix | Delete
);
[25] Fix | Delete
[26] Fix | Delete
// If logged-out and displayLoginAsForm is true, show the login form.
[27] Fix | Delete
if ( ! is_user_logged_in() && ! empty( $attributes['displayLoginAsForm'] ) ) {
[28] Fix | Delete
// Add a class.
[29] Fix | Delete
$classes .= ' has-login-form';
[30] Fix | Delete
[31] Fix | Delete
// Get the form.
[32] Fix | Delete
$contents = wp_login_form( array( 'echo' => false ) );
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
[36] Fix | Delete
[37] Fix | Delete
return '<div ' . $wrapper_attributes . '>' . $contents . '</div>';
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
/**
[41] Fix | Delete
* Registers the `core/loginout` block on server.
[42] Fix | Delete
*
[43] Fix | Delete
* @since 5.8.0
[44] Fix | Delete
*/
[45] Fix | Delete
function register_block_core_loginout() {
[46] Fix | Delete
register_block_type_from_metadata(
[47] Fix | Delete
__DIR__ . '/loginout',
[48] Fix | Delete
array(
[49] Fix | Delete
'render_callback' => 'render_block_core_loginout',
[50] Fix | Delete
)
[51] Fix | Delete
);
[52] Fix | Delete
}
[53] Fix | Delete
add_action( 'init', 'register_block_core_loginout' );
[54] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function