File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
packages/block-library/src Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,12 @@ function render_block_core_form_input( $attributes, $content ) {
19
19
$ visibility_permissions = $ attributes ['visibilityPermissions ' ];
20
20
}
21
21
22
- if ( 'logged-in ' === $ visibility_permissions && ! is_user_logged_in () ) {
22
+ $ user_logged_in = is_user_logged_in ();
23
+
24
+ if ( 'logged-in ' === $ visibility_permissions && ! $ user_logged_in ) {
23
25
return '' ;
24
26
}
25
- if ( 'logged-out ' === $ visibility_permissions && is_user_logged_in () ) {
27
+ if ( 'logged-out ' === $ visibility_permissions && $ user_logged_in ) {
26
28
return '' ;
27
29
}
28
30
return $ content ;
Original file line number Diff line number Diff line change @@ -23,14 +23,16 @@ function render_block_core_loginout( $attributes ) {
23
23
*/
24
24
$ current_url = ( is_ssl () ? 'https:// ' : 'http:// ' ) . $ _SERVER ['HTTP_HOST ' ] . $ _SERVER ['REQUEST_URI ' ];
25
25
26
- $ classes = is_user_logged_in () ? 'logged-in ' : 'logged-out ' ;
26
+ $ user_logged_in = is_user_logged_in ();
27
+
28
+ $ classes = $ user_logged_in ? 'logged-in ' : 'logged-out ' ;
27
29
$ contents = wp_loginout (
28
30
isset ( $ attributes ['redirectToCurrent ' ] ) && $ attributes ['redirectToCurrent ' ] ? $ current_url : '' ,
29
31
false
30
32
);
31
33
32
34
// If logged-out and displayLoginAsForm is true, show the login form.
33
- if ( ! is_user_logged_in () && ! empty ( $ attributes ['displayLoginAsForm ' ] ) ) {
35
+ if ( ! $ user_logged_in && ! empty ( $ attributes ['displayLoginAsForm ' ] ) ) {
34
36
// Add a class.
35
37
$ classes .= ' has-login-form ' ;
36
38
You can’t perform that action at this time.
0 commit comments