• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controller filter does not work in the default controller

#1
Hi, I created a controller filter that checks if the user is logged in, but it doesn't work in the default controller (Home.php in this case).

It also happens that it doesn't work in any index method unless you put it also without the asterisk('user/*', 'user/').

Thank you and I appreciate a reply.

This is how I got it:

// List filter aliases and any before/after uri patterns
// that they should run on, like:

//    'isLoggedIn' => ['before' => ['account/*', 'profiles/*']],
    public $filters = [
        'isLoggedIn' => ['before' => [ 'user/*''user/','home/*']],
Reply

#2
Hello, I had the same problem.
`user/*` means the filter to be applied on any other URIs after user/.

To include `user`, do the following:

`public $filters = [
'isLoggedIn' => ['before' => [ 'user*', 'home*']],
]`

Note, there is no forward-slash before the *.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.