Initialize JS user before bootstrapping
authorMatthias Schmidt <gravatronics@live.com>
Tue, 20 Apr 2021 14:07:46 +0000 (16:07 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 20 Apr 2021 14:07:46 +0000 (16:07 +0200)
See #4123

com.woltlab.wcf/templates/headIncludeJavaScript.tpl
wcfsetup/install/files/acp/templates/header.tpl

index 27d2649b7f60387605acc17140a5d0b728b9019a..599f9f1ea63a320631a9251dfd8de3e3d452574a 100644 (file)
@@ -166,6 +166,12 @@ window.addEventListener('pageshow', function(event) {
                        {event name='javascriptLanguageImport'}
                });
                
+               User.init(
+                       {@$__wcf->user->userID},
+                       '{@$__wcf->user->username|encodeJS}',
+                       {if $__wcf->user->userID}'{@$__wcf->user->getLink()|encodeJS}'{else}''{/if}
+               );
+               
                BootstrapFrontend.setup({
                        backgroundQueue: {
                                url: '{link controller="BackgroundQueuePerform"}{/link}',
@@ -178,8 +184,6 @@ window.addEventListener('pageshow', function(event) {
                        {/if}
                        styleChanger: {if $__wcf->getStyleHandler()->showStyleChanger()}true{else}false{/if}
                });
-               
-               User.init({@$__wcf->user->userID}, '{@$__wcf->user->username|encodeJS}', {if $__wcf->user->userID}'{@$__wcf->user->getLink()|encodeJS}'{else}''{/if});
        });
        
        // prevent jQuery and other libraries from utilizing define()
index fce0153c6708e0b59eff3b26b001391b0f954da6..c6eeddd28be9fdbd82e2f4c49b5e046797e86af2 100644 (file)
                                {event name='javascriptLanguageImport'}
                        });
                        
+                       User.init(
+                               {@$__wcf->user->userID},
+                               '{@$__wcf->user->username|encodeJS}',
+                               {if $__wcf->user->userID}'{@$__wcf->user->getLink()|encodeJS}'{else}''{/if}
+                       );
+                       
                        AcpBootstrap.setup({
                                bootstrap: {
                                        enableMobileMenu: {if PACKAGE_ID && $__isLogin|empty}true{else}false{/if}
                                }
                        });
-                       
-                       User.init({@$__wcf->user->userID}, '{@$__wcf->user->username|encodeJS}', {if $__wcf->user->userID}'{@$__wcf->user->getLink()|encodeJS}'{else}''{/if});
                });
        </script>