Joomla UserName Issue

Locked
zeeshanhashmi
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jul 16, 2008 1:48 am

Joomla UserName Issue

Post by zeeshanhashmi » Wed Aug 20, 2008 4:31 pm

Hi
I am creating an External Application and that will be attached to Joomla using JUMI.

I want to obtain the current USERNAME and then it is stored in my database (of the external script) and then next time if that user login again, he will be able to see his records on my application.

I am using folllowing code:
Just these 2 lines on the top of my script.

Code: Select all

$user =& JFactory::getUser();
$userId = $user->get('username');
and then I can use $userId.

Is it OK ? or its not the correct way to do this ?

Please guide
regards

Zeeshan

zeeshanhashmi
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jul 16, 2008 1:48 am

Re: Joomla UserName Issue

Post by zeeshanhashmi » Thu Aug 21, 2008 1:39 am

Anyone please respond.

I dont know why people do not reply here. There are a lot of other forums where the response is submitted within 1 hour. But I can see that my this post and previous, bot are never answered.

If some one has some knowledge it will be be decreased if you share it with those who doesn't have the required knowledge. (like me)

So please !

Gergo Erdosi
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4031
Joined: Sat Nov 11, 2006 9:34 pm
Location: Hungary

Re: Joomla UserName Issue

Post by Gergo Erdosi » Sun Aug 24, 2008 8:45 am

zeeshanhashmi wrote:

Code: Select all

$userId = $user->get('username');
If you want to store the username, why did you add userid as the name of the variable? Anyway I would suggest to store the id of the user instead of the username, because the name an be changed, but the id will be the same.


Locked

Return to “Joombie Coding Q/A”