Hi,
I have 2 CFs. 1 is for joomla registration, and the other is to upload file. The second CF (which is for uploading file) can only be accessed by registered users when they log in.
In my 2nd CF, I only have 2 elements, 1 textbox (file description) and 1 file upload.
But I want to save also the username, name, and email of currently logged in user into the database table that contains results of my 2nd CF, in addition to the file description and the file upload.
I have tried to write
What have I missed?
Please help.
Thank you
I have 2 CFs. 1 is for joomla registration, and the other is to upload file. The second CF (which is for uploading file) can only be accessed by registered users when they log in.
In my 2nd CF, I only have 2 elements, 1 textbox (file description) and 1 file upload.
But I want to save also the username, name, and email of currently logged in user into the database table that contains results of my 2nd CF, in addition to the file description and the file upload.
I have tried to write
<?php
$user = &JFactory::getUser();
JRequest::setVar('name' $user->username);
?> in OnSubmit code before sending email in Form Code tab. But it won't take the username variable. Instead, there was an error message Parse error: parse error, unexpected T_VARIABLE in C:\Program Files\xampp\htdocs\ISIEM\components\com_chronocontact\libraries\customcode.php(64) : eval()'d code on line 3
What have I missed?
Please help.
Thank you
Hi,
Please try:
But this code will run in the "before email" ONLY if you have some email, do you have one ?
if not then you will need to put it in the "After email" box then go to the "Run order" tab and set the order there so that the "on submit" code runs BEFORE the "auto generated" code
Cheers
Max
Please try:
<?php
$user = &JFactory::getUser();
JRequest::setVar('name', $user->username);
?>But this code will run in the "before email" ONLY if you have some email, do you have one ?
if not then you will need to put it in the "After email" box then go to the "Run order" tab and set the order there so that the "on submit" code runs BEFORE the "auto generated" code
Cheers
Max
Hi Max, thx alot for your reply. It really helps!!:D
Now that I find another problem. My joomla registration CF contains more textboxes, not only name, username, and password, but also institution, occupation, phone number and etc.
I have tried your code and I have managed to take name and email. But I couldn't take institution, occupation, and the others. (Those are field names of my joomla registration CF)
I also have tried to save the result of registration CF to jos_users, but those fields (fields other than name, username, email) remains empty. & when I checked in phpmyadmin, there were 2records of the same username. The account couldn't be activated either both from front & back end.
I also tried to save the result of registration CF to a new jos_chronoforms_register table. But the password is not encrypted, so I felt unsafe to use this way. Besides, I have no idea how to take record from a field of another CF table.
I wrote this
Please help.
Thanks alot.
Now that I find another problem. My joomla registration CF contains more textboxes, not only name, username, and password, but also institution, occupation, phone number and etc.
I have tried your code and I have managed to take name and email. But I couldn't take institution, occupation, and the others. (Those are field names of my joomla registration CF)
I also have tried to save the result of registration CF to jos_users, but those fields (fields other than name, username, email) remains empty. & when I checked in phpmyadmin, there were 2records of the same username. The account couldn't be activated either both from front & back end.
I also tried to save the result of registration CF to a new jos_chronoforms_register table. But the password is not encrypted, so I felt unsafe to use this way. Besides, I have no idea how to take record from a field of another CF table.
I wrote this
<?php
$user = &JFactory::getUser();
JRequest::setVar('name', $user->name);
JRequest::setVar('email', $user->email);
$db = &JFactory::getDBO();
$query = "SELECT institution FROM jos_chronoforms_register WHERE uname=$user->name";
JRequest::setVar('institution', $institution);
?> but it didn't work. Do I miss anything again? :? Please help.
Thanks alot.
Hi,
anyone here has faced the same situation as me ? Would please share an example? I'm completely lost here😢 I saw the same question answered by Bob, but he only told him/her to create another table and join with jos_users later without telling how to do it.
Please help.
Regards,
Achiet.
Thank you in advance for the answers.
anyone here has faced the same situation as me ? Would please share an example? I'm completely lost here😢 I saw the same question answered by Bob, but he only told him/her to create another table and join with jos_users later without telling how to do it.
Please help.
Regards,
Achiet.
Thank you in advance for the answers.
Hi,
I got it!! I searched in this forum and found the answer in
viewtopic.php?f=2&t=16670&p=44967 thanks to Bob's explanation.
Bob, Max, u guys are the best!! And your tool is really great😀
Cheers,
achiet
I got it!! I searched in this forum and found the answer in
viewtopic.php?f=2&t=16670&p=44967 thanks to Bob's explanation.
Bob, Max, u guys are the best!! And your tool is really great😀
Cheers,
achiet
I tried
but I was unable to get it to work, I think I may have done something wrong along the way.
<?php
$user = &JFactory::getUser();
JRequest::setVar('name', $user->username);
?>but I was unable to get it to work, I think I may have done something wrong along the way.
This topic is locked and no more replies can be posted.
