Talk

Difference between revisions of "Accessing the current user object"

From Joomla! Documentation

(New page: Is there a way to get a JUser object by real name? It is possible, to get it by SELECTing its id from the database, but that just not seems like the right way to me. --~~~~)
 
 
Line 4: Line 4:
  
 
--[[User:UsagiYojimbo|UsagiYojimbo]] 10:16, 18 November 2009 (UTC)
 
--[[User:UsagiYojimbo|UsagiYojimbo]] 10:16, 18 November 2009 (UTC)
 +
 +
== Import new user id to a table ==
 +
 +
Hi,
 +
 +
I have created a plugin that inserts a record in a new table when a new user registers. Im using the function onAfterStoreUser and $user = & JFactory::getUser(); $id_user = $user->get('id'); to get the new id.
 +
The problem is that the $id_user get the value 0 because the user is created but not logged in.
 +
 +
How else can i get the id of the new user?
 +
 +
 +
Thanks

Latest revision as of 05:29, 28 July 2010

Is there a way to get a JUser object by real name?

It is possible, to get it by SELECTing its id from the database, but that just not seems like the right way to me.

--UsagiYojimbo 10:16, 18 November 2009 (UTC)

Import new user id to a table[edit]

Hi,

I have created a plugin that inserts a record in a new table when a new user registers. Im using the function onAfterStoreUser and $user = & JFactory::getUser(); $id_user = $user->get('id'); to get the new id. The problem is that the $id_user get the value 0 because the user is created but not logged in.

How else can i get the id of the new user?


Thanks