XF 2.0 Have ACP Log Out at the top

ibaker

Well-known member
Just in case this may help others, I found that the placement of the Log Out button at the bottom of the page in the ACP of v2 to be extremely silly and very much NOT user friendly. So, for anyone who may want to have it also at the top of the page this may help...NOTE, this is what I did in XF v2.0.10

1. Turn Development Mode on
In the src folder edit the config.php file by adding:
Code:
$config['development']['enabled'] = true;
at the bottom of the file

2. Go into your XF Admin Control Panel (ACP)

3. Go to Appearance and select Templates

4. At the top of the template list you should see a Style box...click it and ensure Master Style is selected.

5. You should now see 3 tabs at the top of the template list, Public - Email - Admin...select Admin

6. Scroll down and open the template PAGE_CONTAINER to edit it

7. At line 37 you should see the line:
Code:
<a href="index.php" class="p-header-button p-header-button--title" target="_blank">{$xf.options.boardTitle}</a>
After that line add this line
Code:
<a href="{{ link('login/logout', null, {'t': csrf_token()}) }}" class="p-header-button p-header-button--title">{{ phrase('log_out') }}</a>
Save and Exit the template

You should now see the Log Out link next to the link to your site front end:
1.webp

8. The final step is to either change the word true to false in the line you added to your config.php file in step 1 or remove the line all together...it is handy to keep it in there but just turn the development mode off by changing the true to false as in:
Code:
$config['development']['enabled'] = false;

That is all you need to do and I hope it helps
 
While you are there as above here is another little thing that the developers left out to make your life easier.

When viewing the Template List the pagination is only at the bottom but what happens if you know the template you wish to view is on the 2nd or even 3rd page of the list...you have to scroll all the way down the bottom of the page to go to the next page or another page in the list.

So while you are there doing the LogOut link as in the post above you may as well help yourself out by putting a pagination at the top of the page of the Template List...here's how:

1. Do the steps of 1 to 5 in the above post

2. Find the template template_list and open it to edit

3. Find this block at approx line 23:
Code:
            <xf:macro template="addon_macros" name="addon_change_menu"
                arg-addOns="{$addOns}"
                arg-currentAddOn="{$currentAddOn}"
                arg-route="styles/templates"
                arg-routeData="{$style}"
                arg-routeParams="{$linkParams}" />

4. After that code add this piece of code:
Code:
<xf:comment> added page nav </xf:comment>
        <xf:pagenav
            page="{$page}" perpage="{$perPage}" total="{$total}"
            link="styles/templates"
            params="{$linkParams}"
            data="{$style}"
            wrapperclass="js-filterHide block-outer block-outer--after" />

5. Save the template and you should now see the pagination add to the top to make it easier for you to navigate through the pages of templates:
1.webp

Hope this helps!
 
While you are there as above here is another little thing that the developers left out to make your life easier.

When viewing the Template List the pagination is only at the bottom but what happens if you know the template you wish to view is on the 2nd or even 3rd page of the list.
I tend to just use the filter option, can't say I even noticed the pagination before :eek:...so I'd say that is the reason for no pagination at the top.

1539480388433.webp

Anyhow, just a note that these edits will be overwritten on updates. They should really be in an addon to save the hassle of re-applying them after a software update.
 
Brilliant - just saved me hours of digging around trying to sort that out so thanks for posting

Although I've made one small tweak as a suggestion. I have different admin accounts, moderator and super admin, in XF1 the acp gave an indication of which account I was logged in as. Perhaps I've missed it in XF2 but I couldn't easily see which account I was in on the acp. So I added {{$xf.visitor.username}} to the end of the button title.

Code:
        <a href="{{ link('login/logout', null, {'t': csrf_token()}) }}" class="p-header-button p-header-button--title">{{ phrase('log_out') }} {{$xf.visitor.username}} </a>

So now I have my username on the logout button.

194958
 
It's such a very little simple edit that can be done at any time and well, it should be included as default just like it was in v1.x so obviously the change in v2.x was just for change sake, very frustrating as the change adds no value 😖
 
It's such a very little simple edit that can be done at any time and well, it should be included as default just like it was in v1.x so obviously the change in v2.x was just for change sake, very frustrating as the change adds no value 😖
Have you made a suggestion?

 
To be fair, having the logout button on the bottom doesn’t seem like a great idea.

It’s quite unintuitive having that kind of link anywhere but the header or main menu somewhere. And is rather silly on mobile has you have to swipe swipe swipe to get to the footer.

It would be better to have the user avatar, with a logout option when clicked.

Or for it to say Log out 'Username'

195033
 
I just deleted a whole bunch of posts that really don't add anything useful to the discussion, that basically all spawned out of what was basically semantics and splitting hairs on what was clearly someone's opinion on a change. If you don't have anything useful to post, don't post.
 
It’s quite unintuitive having that kind of link anywhere but the header or main menu somewhere. And is rather silly on mobile has you have to swipe swipe swipe to get to the footer.
I can see your problem though I don't use mobile as it's enough of a pain on desktop when ever the page refreshes to the top and have to scroll down to log out. I mentioned this before but it was pretty much sloughed off and hasn't changed. When @Steve F suggested an add on for this problem so template changes aren't erased with updates, I thought what better than a reputable dev to make this add on.
I'm using your suggestion of change and it was easy and works well but don't look forward having to make this edit every time there is an update. Creates added work for admins when it is a simple change to core code to put the log out back at the top where IMO it belongs and is more intuitive.
 
When @Steve F suggested an add on for this problem so template changes aren't erased with updates, I thought what better than a reputable dev to make this add on.
Unfortunately I'm not a reputable dev - just a noobie. However I wanted to have a go at making an add-on and this was a nice simple one to start learning with.

So here we go.

 
Unfortunately I'm not a reputable dev - just a noobie. However I wanted to have a go at making an add-on and this was a nice simple one to start learning with.

So here we go.

Thanks for your noobie endeavor. As it turns out I have a new install on my test folder to try it out on LOL Will let you know how that goes :)
 
Just updated to XF v2.1.10 Patch 2 and found a couple of changes needed...in essence it is the same but just different line numbers...

1. To add the Log Out at the top right corner, find this code (should be around line 70) in the Admin version of the PAGE_CONTAINER template:
Code:
        <form action="{{ link('search/search') }}" class="menu menu--structural menu--veryWide" data-xf-init="admin-search" data-menu="menu" aria-hidden="true">
            <div class="menu-content">
                <h3 class="menu-header">{{ phrase('search...') }}</h3>
                <div class="menu-row">
                    <input type="text" name="q" autocomplete="off" class="input js-adminSearchInput" data-menu-autofocus="" />
                </div>
                <div class="menu-scroller p-quickSearchResultsWrapper js-adminSearchResultsWrapper">
                    <div class="p-quickSearchResults js-adminSearchResults"></div>
                </div>
            </div>
        </form>

and add this code immediately after it:
Code:
<xf:comment> added log out at top </xf:comment>
        <a href="{{ link('login/logout', null, {'t': csrf_token()}) }}" class="p-header-button p-header-button--title">{{ phrase('log_out') }}</a>

2. To add template pagination at the top of your templates page, find this code (should be around line 23) in the Admin version of the template_list template:
Code:
            <xf:macro template="addon_macros" name="addon_change_menu"
                arg-addOns="{$addOns}"
                arg-currentAddOn="{$currentAddOn}"
                arg-route="styles/templates"
                arg-routeData="{$style}"
                arg-routeParams="{$linkParams}" />

and add this code immediately after it:
Code:
<xf:comment> added page nav </xf:comment>
        <xf:pagenav
            page="{$page}" perpage="{$perPage}" total="{$total}"
            link="styles/templates"
            params="{$linkParams}"
            data="{$style}"
            wrapperclass="js-filterHide block-outer block-outer--after" />

Makes life so much easier and I have no idea why Xenforo don't add these 2 very small snippets of code to make it much easier for the customers

1.webp
 
Thankyou very much for the feedback - I really do appreciate that. I've not had much time to concentrate on these as due to the current pandemic I'm working absolutely flat out on IT support issues for my employer.

However I will endeavour to get an update out as soon as possible. So once again many thanks.

Regards

Adrian
 
Top Bottom