Monday, August 4, 2014

Re: cakephp url change

You can save their account number to the session, a few examples:

$this->Session->read('Auth.User.id') is the user id once being logged in
$this->Session->read('Auth.User.account_number') would hold the account_number field from the users table (if you had one).

Or you could go through $this->Auth->user('id') for example.

You may need to add to your login method if the account number is not inside the user's table just to save it to the session etc.

return $this->redirect(array('controller' => 'property', 'action' => 'add', $accountNumber);

Though it begs the question that if this number is available always, do you really need to pass it as a parameter and instead just read it inside the PropertiesController function add() ?

HTH


On 4 August 2014 09:30, vbpupil <vbpupil@gmail.com> wrote:
Hi guys

I have a question that im sure someone will be able to answer very quickly.

Im working on a site where customers can add their own property to sell, if they click list a property the system first checks that they are logged in if not asks them to login, then upon a successful signin it forward them to their original destination ie:


www.mysite.com/property/add

however, i want them to go to:


www.mysite.com/property/add/76

76 being their account number, but of course originally I wont know what that would be, how do i add this?

thanks in advance

--
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.



--
Kind Regards
 Stephen Speakman

--
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: