Make sure your Auth session is set as well

function edit($id=null){
  If ($id==$this->Auth->user('id')) {
     user can edit
 }
 else {
     redirect...
 }
}

On Feb 19, 4:45 pm, amarradi <[email protected]> wrote:
> On 19 Feb., 22:31, Future22 <[email protected]> wrote:> If 
> ($this->params['id']=$this->Auth->user('id')) {
> >     user can edit}
>
> > else {
> >     redirect...
>
> > }
>
> This doesn't run.
> The if-statement had an bug. The ==
> If ($this->params['id']==$this->Auth->user('id')) {
>
> >     user can edit}
>
> > else {
> >     redirect...
>
> > }
>
> But it is no change.
> Here my bug context
> In line 73 is the if-statement as the first statement in the action
> ==========================================================
> Notice (8): Undefined index:  id [APP/controllers/
> users_controller.php, line 73]
>
> Code | Context
>
> $id     =       "1"
>
>     }
>     function edit($id = null) {
>         if($this->params['id']==$this->Auth->user('id')) {
>
> UsersController::edit() - APP/controllers/users_controller.php, line
> 73
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 116
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 259
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213
> [main] - APP/webroot/index.php, line 90
>
> Warning (2): Cannot modify header information - headers already sent
> by (output started at /opt/lampp/htdocs/cakePHP/cake/basics.php:111)
> [CORE/cake/libs/controller/controller.php, line 587]
>
> Code | Context
>
> $status =       "Location:http://localhost/cakePHP/users";
>
> header - [internal], line ??
> Controller::header() - CORE/cake/libs/controller/controller.php, line
> 587
> Controller::redirect() - CORE/cake/libs/controller/controller.php,
> line 568
> UsersController::edit() - APP/controllers/users_controller.php, line
> 92
> Object::dispatchMethod() - CORE/cake/libs/object.php, line 116
> Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 259
> Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213
> [main] - APP/webroot/index.php, line 90
>
> (default) 0 query took ms
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to