Monday, November 17, 2014

Re: Plugin login problem

The Form::create() call was done incorrectly, it should be:

$this->Form->create('User', array('url' => array('admin' => false, 'plugin' => null, 'controller' => 'users', 'action' => 'login')));

On Thursday, November 6, 2014 5:11:36 AM UTC-5, Lucky1968 wrote:
Hi,

I'm using CakePHP 2.3.10 and I have a problem with a login form in my header.
When the login form is used from within a plugin view it sends the form to /plugin_name/users/login instead of to /users/login.

I have found numerous posts on this topic and all state the same: I need to add 'plugin' => null or 'plugin' => false at some places. But that I did already from the beginning and I still have the problem.

Can anyone tell me what's wrong with my code?

Here's my code:

AppController.php
public function beforeFilter() {
...
$this->Auth->loginAction = array('plugin' => null, 'controller' => 'users', 'action' => 'login');
...
}

UsersController.php
public function beforeFilter() {
parent::beforeFilter();
...
}

PluginAppController.php
public function beforeFilter() {
parent::beforeFilter();
}

In the element used by the selected layout:
<?php echo $this->Form->create('User', array('admin' => false, 'plugin' => null, 'controller' => 'users', 'action' => 'login')); ?>

I also tried with 'plugin' => false but the results are the same.

Thanks for any help.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: