Store
Community Documentation

v3 Knowledgebase

Add onclick confirm to logout menu

First off just wanted to thank webmasterx for the little onclick=return confirm bit he helped me with on version 1.6.20
to add onclick confirm to your log out menu navigate to your admincp.mouse over the "extensions" tab then mouse over the "themes" tab under the themes tab click on "manage themes".Click the down arrow beside phpfox (default) and then click "edit templates".
under global templates click on "template.html.phpin that file look for
PHP:
<div id="navigation">
                    <
div id="right_nav">                
                        <
ul>
                            {foreach 
from=$aRightMenus key=iKey item=aMenu}
                                <
li{if isset($aMenu.is_selected)} class="active"{/if}><a href="{url link=$aMenu.url}">{phrase var=$aMenu.module'.'$aMenu.var_name}</a>
                                {if isset(
$aMenu.children) && count($aMenu.children)}
                                <
ul>
                                    {foreach 
from=$aMenu.children item=aChild name=child_menu}
                                    <
li{if $phpfox.iteration.child_menu == 1} class="first"{/if}><a href="{url link=$aChild.url}">{phrase var=$aChild.module'.'$aChild.var_name}</a></li>
                                    {/foreach}
                                </
ul>
                                {/if}
                                </
li>
                            {/foreach}
                            {unset var=
$aRightMenus var2=$aMenu var3=$iKey}
                        </
ul>                
                    </
div>
                </
div
and change that with this
PHP:
<div id="navigation">
                    <
div id="right_nav">                
                        <
ul>
                            {foreach 
from=$aRightMenus key=iKey item=aMenu}
                                   {if (
$aMenu.var_name == menu_log_out)}
                                <
li{if isset($aMenu.is_selected)} class="active"{/if}><a href="{url link=$aMenu.url}" onclick="return confirm('Are you sure you want to logout?');">{phrase var=$aMenu.module'.'$aMenu.var_name}</a>
                                {else if}
                                <
li{if isset($aMenu.is_selected)} class="active"{/if}><a href="{url link=$aMenu.url}">{phrase var=$aMenu.module'.'$aMenu.var_name}</a>
                                {if isset(
$aMenu.children) && count($aMenu.children)}
                                <
ul>
                                    {foreach 
from=$aMenu.children item=aChild name=child_menu}
                                    <
li{if $phpfox.iteration.child_menu == 1} class="first"{/if}><a href="{url link=$aChild.url}">{phrase var=$aChild.module'.'$aChild.var_name}</a></li>
                                    {/foreach}
                                </
ul>
                                {/if}
                                {/if}
                                </
li>
                                </
li>
                            {/foreach}
                            {unset var=
$aRightMenus var2=$aMenu var3=$iKey}
                        </
ul>                
                    </
div>
                </
div
click "save and thats it.if you are using the foxbook theme navigate like above for the phpfox theme only click the down arrow beside foxbook instead of phpfox (default) and click "edit templates".
Under the "global templates" click on "template.html.php
and look for
PHP:
<div id="right_menu_left">
                        <
ul class="top_menu" id="main_nav">
                            {foreach 
from=$aRightMenus key=iKey item=aMenu}
                                <
li><a href="{url link=$aMenu.url}">{phrase var=$aMenu.module'.'$aMenu.var_name}</a>
                                {if isset(
$aMenu.children) && count($aMenu.children)}
                                    <
ul>
                                    {foreach 
from=$aMenu.children item=aChild name=child_menu}
                                        <
li><a href="{url link=$aChild.url}">{phrase var=$aChild.module'.'$aChild.var_name}</a></li>
                                    {/foreach}
                                    </
ul>
                                {/if}
                                </
li>
                            {/foreach}
                            {unset var=
$aRightMenus var2=$aMenu var3=$iKey}
                        </
ul>
                        <
div class="clear"></div>
                    </
div
change that with this code
PHP:
<div id="right_menu_left">
                        <
ul class="top_menu" id="main_nav">
                            {foreach 
from=$aRightMenus key=iKey item=aMenu}
                                {if (
$aMenu.var_name == menu_log_out)}
                                <
li><a href="{url link=$aMenu.url}" onclick="return confirm('Are you sure you want to logout?');">{phrase var=$aMenu.module'.'$aMenu.var_name}</a>
                                {else if}
                                <
li><a href="{url link=$aMenu.url}">{phrase var=$aMenu.module'.'$aMenu.var_name}</a>
                                {if isset(
$aMenu.children) && count($aMenu.children)}
                                    <
ul>
                                    {foreach 
from=$aMenu.children item=aChild name=child_menu}
                                        <
li><a href="{url link=$aChild.url}">{phrase var=$aChild.module'.'$aChild.var_name}</a></li>
                                    {/foreach}
                                    </
ul>
                                {/if}
                                {/if}
                                </
li>
                                </
li>
                            {/foreach}
                            {unset var=
$aRightMenus var2=$aMenu var3=$iKey}
                        </
ul>
                        <
div class="clear"></div>
                    </
div
Click "save" and your done, now when a user logs out there should be alittle window that pops up that asks if they are sure they want to log out.