Change the URL in the view.
echo $this->Form->create('User', array('url' => '/account/profile'));
On Sep 16, 3:45 am, Trent <[email protected]> wrote:
> I think you miss understood.
>
> The person views their profile on account/profile. Because this page
> is just a route to users/profile when you submit that page, the form
> is posting to users/profile/15 instead of posting to account/profile.
>
> How do I stop it from posting to users/profile/15. I do not want their
> userid there.
>
> On Sep 16, 3:19 am, Miles J <[email protected]> wrote:
>
> > 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