Yii Framework Forum: Yii::app()->user->id; is returning username instead of id number - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii::app()->user->id; is returning username instead of id number Rate Topic: -----

#1 User is offline   amorangi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 29
  • Joined: 01-May 09

Posted 09 May 2010 - 07:23 PM

I have a very strange problem in that on one machine Yii::app()->user->id; returns the username, but on another machine running identical code I'm getting the id number as expected. I'm using the User Management Module 0.5, though I don't know if that's anything to do with it. The only difference between the machines is one is x64 and the other is x32 - again - I don't think that has anything to do with it.

How could Yii::app()->user->id be getting the username? What have I missed?
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 10 May 2010 - 01:39 AM

By default getId() method returns username it has to be overriden to return id...

Check this documentation http://www.yiiframew...-identity-class

Quote

We also override the getId method toreturn the _id variable which is set during authentication (the defaultimplementation would return the username as the ID).

Find more about me.... btw. Do you know your WAN IP?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users