Try using:
Router::connect('/account/profile/*', array('controller' => 'users',
'action' => 'profile'));
No you cant stop them from going to /users/profile that I know of. Why
don't you just change the users controller to account?
On Sep 15, 4:34 am, Trent <[email protected]> wrote:
> I have the following route:
>
> Router::connect('/account/profile', array('controller' => 'users',
> 'action' => 'profile'));
>
> When I am on /account/profile and save without having a first name it
> shows an error on the page and the url in the browser has changed to /
> users/profile/15. How can I stop this? And is there a way to
> completely block the page from loading if they try to go to users/
> profile instead of account/profile?
>
> This is my controller:
>
> function profile(){
> $id=$this->Session->read('Auth.User.id');
> if (!empty($this->data) && $id) {
> $this->data['User']['id']=$id;
> if ($this->User->save($this->data)) {
> $this->Session->setFlash(__('Your profile has been updated',
> true));
> $this->redirect(array('action' => 'profile'));
> }
> else {
> $this->Session->setFlash(__('The user could not be saved.
> Please, try again.', true));
> }
> }
> if (empty($this->data)) {
> $this->data = $this->User->read(null, $id);
> }
> $titles = $this->User->titles();
> $this->set(compact('titles'));
>
> }
>
> Thanks.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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