I use CakeDC users plugin, and I have an Element : menu.ctp, in which I have some code like this:
<?php if (!empty($isLogged)): ?> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><?= $this->html->link('Clients', array('controller'=>'Clients', 'action' => 'index', 'plugin' => null))?></li> </ul> <ul class="nav navbar-nav"> <li><?= $this->html->link('Assets', array('controller'=>'Assets', 'action' => 'index', 'plugin' => null))?></li> </ul> <ul class="nav navbar-nav"> <li><?= $this->html->link('KACE', array('controller'=>'Machines', 'action' => 'index', 'plugin' => null))?></li> </ul> <ul class="nav navbar-nav"> <li><?= $this->html->link('Rooms', array('controller'=>'Rooms', 'action' => 'index', 'plugin' => null))?></li> </ul> <ul class="nav navbar-nav"> <li><?= $this->html->link('Departments', array('controller'=>'Departments', 'action' => 'index', 'plugin' => null))?></li> </ul> <ul class="nav navbar-nav"> <li><?= $this->html->link('Reports', array('controller'=>'Pages', 'action' => 'reports', 'plugin' => null))?></li> </ul> <?php if($isLogged['is_superuser']) { ?> <ul class="nav navbar-nav"> <li><?= $this->Html->link(__('Users'), ['plugin' => 'CakeDC/Users','controller' => 'Users','action' => 'index']) ?></li> </ul> <?php } ?> <ul class="nav navbar-nav navbar-right"> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown"> <span><b><?= h($isLogged['first_name'] . ' ' . $isLogged['last_name']) ?> <?php if($isLogged['is_superuser']) { ?>(Admin)<?php } ?> </b></span> </a> <div class="dropdown-menu"> <a class="dropdown-item" href="users/users/change-password"> Change Password</a> <br> <a class="dropdown-item" href="users/users/logout"> Logout</a> </div> </li> </ul> </div><!--/.nav-collapse --> <?php endif; ?>
The logout url is not working perfectly, from all pages. Sometimes it becomes:
The right link should be: http://localhost/project/users/users/logout
but in some cases, I get:
http://localhost/project/assets/users/users/logout
http://localhost/project/pages/users/users/logout
etc.
I know that the issue is this line:
href=“users/users/logout”> Logout
but I failed to fix it.