Forums

Can we edit jos_user table?

kayrie 03 Nov, 2011
Hye guys,

Just wanna ask can we add new field name at jos_user table than call back the data inside that field name using same code as below :
eg : field name> horoscope : virgo
<?php
$user = JFactory::getUser();
$Id = $user->id;
$Name = $user->name;
$Horoscope = $user->horoscope;
?>


Really appreciate your help.
Thank You
Uclabruins 03 Nov, 2011
Adding a column (field) to the jos_user table is risky (assuming the jos_user table is where your Joomla user information is stored). Unless you really know what you're doing, you should avoid this. At the very least, it's likely to cause problems when Joomla is updated.

If you wanted to link users to a horoscope, you could create a new table and get the user id of the individual and put that in one column and put the horoscope in another column. Then you could use the record loader function in chronoforms to show that horoscope using the new table.
kayrie 03 Nov, 2011
Thank You for reply.
What you mean by record loader function?
GreyHead 03 Nov, 2011
Hi Kayrie,

Uclabruins is correct, in general you shouldn't add data to the jos_users table. In this case though, you could use the User parameters to add the info you need. You can add and edit parameters without changing the structure of the table and you can access them through the Joomal User Object.

Bob
This topic is locked and no more replies can be posted.