id}"; ?>"it gave me my id i need user name how can i get it from user tablesorry for simple question🙂"> very simple but need help - Forums

Forums

very simple but need help

kurt2000 31 Oct, 2009
hi, maybe it is very simple but how can i get user name from user table to my edit_Recorde page.
i use

<?php $user =& JFactory::getUser();
echo "{$user->id}"; ?>"
it gave me my id i need user name how can i get it from user table

sorry for simple question🙂
GreyHead 31 Oct, 2009
Hi Kurt2000,

<?php 
$user =& JFactory::getUser();
echo "Your id is ".$user->id; 
echo "<br />";
echo "Your name is ".$user->name;
?>

Bob
kurt2000 31 Oct, 2009
thx very much our team at holiday🙂 i ll try it
kurt2000 01 Nov, 2009
sorry bob but this not thing i asked.. this gives my id and my name at session time
but i want connectivety shows user name .. but i can only see id from table jos_content however user name at jos_user .. how can i show it

thx
kurt2000 01 Nov, 2009
<?php
            $database->setQuery( "SELECT * FROM #__sections" WHERE id = "{sectionid}" );
            $sections = $database->loadObjectList();
            foreach($sections as $sections){
        ?>

doesnt work
GreyHead 01 Nov, 2009
Hi Kurt2000,

I'm not sure that I'm understanding your questions clearly.

If you want find the name of a user from their id then you can use
$user_2 =& JFactory::getUser($id);


Where are you using the SQL? You probably can't use the {field_name} syntax in there but need to get the section id from
$sectionid = JRequest::getInt('sectionid');
. . .
WHERE `id` = $sectionid
. . .

Bob
kurt2000 01 Nov, 2009
user send a form and my moderator has to control it ok.. i use both
chrono forms and connectivity. in connectivity and edit form (which is a chrono form also) there is a form posted before and it has fields like created_by sectionid ext. in edit form i want to show user name which related with jos_user table and in my jos_content table i ve user_id
now
it is possible to show user name in edit form and chronoview ?
GreyHead 01 Nov, 2009
Hi Kurt,

Yes, if you have a user id as say $id then you can use
$user_2 =& JFactory::getUser($id);
to get information for that user then $user_2->name will give you their name.

Bob
kurt2000 02 Nov, 2009
thx did it u r a hero🙂
This topic is locked and no more replies can be posted.