Hi!
I know that this subject has been treated several times (I read many topics) but I can not find a solution.
I would like to extract the data of the logged user, but my data are in another table (not #_users) so I tried to configure the DB Read module.
In Custom Code I set:
In DB Read I set:
Table name: ysy6w_jsn_users
Multi read: yes
Enable Model ID: no
Fields: id, firstname, lastname
Conditions:
In Designer Section I put a Text Box
Field Name: firstname
Field ID: firstname
obviously missing something...
how can I populate my text box form with "firstname" recovering it in my table filtering it by logged user ID?
Many thanks!
I know that this subject has been treated several times (I read many topics) but I can not find a solution.
I would like to extract the data of the logged user, but my data are in another table (not #_users) so I tried to configure the DB Read module.
In Custom Code I set:
<?php
$user = JFactory::getUser();
$id = $user->id;
?>
In DB Read I set:
Table name: ysy6w_jsn_users
Multi read: yes
Enable Model ID: no
Fields: id, firstname, lastname
Conditions:
<?php
return array('firstname' => $form->data['firstname']);
?>
In Designer Section I put a Text Box
Field Name: firstname
Field ID: firstname
obviously missing something...
how can I populate my text box form with "firstname" recovering it in my table filtering it by logged user ID?
Many thanks!
Hello Retinal,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I ask new users for information and not ask logged in users?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I ask new users for information and not ask logged in users?
P.S: I'm just an automated service😉
Please disable "Multi read".
Regards,
Max
Regards,
Max
Hi Retinal,
The #__users table doesn't have first_name or last_name columns, just name.
And you don't need the database query - all of the information in #__users is available in the $user object that you already have to get the id.
Bob
The #__users table doesn't have first_name or last_name columns, just name.
And you don't need the database query - all of the information in #__users is available in the $user object that you already have to get the id.
Bob
Hi GreyHead,
thanks for your reply.
I know that #_users table has no lastname and firstname columns but I use EasyProfile component for my users so I need to get user Id to use it (like a Join) to extract some value from #_jsn_users (that is the EasyProfile table).
So I would like to get user ID with Custom Code:
$user = JFactory::getUser();
$id = $user->id;
and in DB Read function I set the EasyProfile table #_jsn_users and I would use the logged user id as a key to extract user data and fill my text box.
Can you help me?
Many thanks!
thanks for your reply.
I know that #_users table has no lastname and firstname columns but I use EasyProfile component for my users so I need to get user Id to use it (like a Join) to extract some value from #_jsn_users (that is the EasyProfile table).
So I would like to get user ID with Custom Code:
$user = JFactory::getUser();
$id = $user->id;
and in DB Read function I set the EasyProfile table #_jsn_users and I would use the logged user id as a key to extract user data and fill my text box.
Can you help me?
Many thanks!
Hi Retinal,
What is the name of the User ID column in the Easy Profile table?
Bob
What is the name of the User ID column in the Easy Profile table?
Bob
Hi Retinal,
Then in the Custom Code action add:
In DB Read set:
Add a Debugger action after the DB Read to check that you are getting the data you need.
Bob
Then in the Custom Code action add:
<?php
$user = JFactory::getUser();
$form->data['user_id'] = $user->id;
?>
In DB Read set:
Table name: ysy6w_jsn_users
Multi read: No
Enable Model ID: No
Fields: id,firstname,lastname // note - no spaces here
Conditions:
<?php
return array('id' => $form->data['user_id']);
?>
Add a Debugger action after the DB Read to check that you are getting the data you need.
Bob
This topic is locked and no more replies can be posted.