Monday, April 27, 2009

Re: User Id Question

Are you using Auth? What's the route for this URL? This should work:

$html->link(
'edit profile',
array(
'controller' => 'users',
'action' => 'edit',
'user_id' => $session->read('Auth.User.id')
),
array('title' => 'whatever')
)

If you don't have a route that specifically passes user_id, you can also do:

$html->link(
'edit profile',
array(
'controller' => 'users',
'action' => 'edit',
$session->read('Auth.User.id')
),
array('title' => 'whatever')
)

On Mon, Apr 27, 2009 at 10:34 AM, Teedaddy <bretteegarden@gmail.com> wrote:
>
> Thanks for the response, but this still doesn't answer my question of
> how to include this variable in a $htmlhelper link, mainly need to
> know the syntax. thanks so much
>
> On Apr 26, 10:36 pm, NegoBlack® <paulomoacir.jun...@gmail.com> wrote:
>> I use to do this on my app_controller.php:
>>
>> public function beforeFilter(){
>>
>>     if ($this->Auth->user()){
>>         $this->set("userInfo", $this->Auth->user())
>>     }
>>
>> }
>>
>> Then I can use this var on my views...
>>
>> On Apr 25, 7:57 pm, Teedaddy <bretteegar...@gmail.com> wrote:
>>
>> > Could someone be so kind to tell me the easiest way to pass the
>> > current logged in "Auth" user id in $htmlhelper links?
>>
>> > Thank you so much, just learning all this MVC method and have been
>> > through Auth tutorials numerous times but I am missing this somehow.
>>
>> > Bret
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: