• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Logout Form with xfConfirm


Well-known member
I'm trying to build a logout form on an external page.

            <form action="<?php echo XenForo_Application::get('options')->boardUrl; ?>/logout" method="post" id="pageLogout">

                <div class="ctrlWrapper">
                    <dl class="ctrlUnit">
                            <input type="submit" class="xenword_logout logout" value="log out" />

                <input type="hidden" name="cookie_check" value="1" />
                <input type="hidden" name="redirect" value="<?php $post = ''; get_permalink( $post->ID ); ?>" />
                <input type="hidden" name="_xfToken" value="$visitor.csrf_token_page " />
                <input type="hidden" name="_xfConfirm" value="1" />

This returns a security error even if I remove the xfConfirm. I used to have a direct link to the XenForo logout page but had to always click on confirm so I'm trying to work around it.

Do you have any suggestions on a logout form so that there is no security error and there is no need to confirm?

Jake B.

Well-known member
<input type="hidden" name="_xfToken" value="$visitor.csrf_token_page " />
should be
<input type="hidden" name="_xfToken" value="<?php echo $visitor.csrf_token_page; ?>" />


Well-known member
Thank you everyone.

This almost works but the redirect fails. This is almost what I use to login and the redirect works.