• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Need to grab Juser fields info for RS Forms.

Need to grab Juser fields info for RS Forms. 15 years 9 months ago #3808

  • alexc
  • alexc's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
I have installed a component Juser to have the ability to add a couple custom fields for user registration.

I created a form with RS Forms with 2 hidden fields (for name and email) and found a script here that allows me to grab that info from the database and inputs it for the hidden fields.

Works great.

However I just created 2 more hidden fields and want to do the same thing meaning getting the info from the 2 custom fields and input into the hidden form fields.

Does anyone have experience with Juser? and can shed some light on this issue. Thanks!
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 8 months ago #4524

I can not test Juser because it is only for Joomla 1.x

Is there any extension like this for Joomla 1.5?
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 8 months ago #4529

Hi!
i think this code will help you fetch any value from any table
i am sure if your jusers have a specific table and fields this will work
Where ever you need the value just paste this code in the default value space with your db info.
//<code>
global $database, $my;
$mydata = $my->id;//value for fetching the userid
if($mydata!=0)//checking the user is logged in or not.
{
$data = mysql_query(\"SELECT * FROM jos_table_name \")
or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
return $info;//firstname is filed name from the jos_table
}
}
else
{
return 'norecods';
}
//</code>

still you have difficulty let me know i will help around.
Ramchandran S
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 8 months ago #4598

Hi Ramchandran,

Thanks for posting this code. I used it and it pulls the data in the field on the first record in the table.

Is there any chance you could help me figure out how to get it to pull the data from the field in a specific record?

Thanks in advance.
Adam
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 8 months ago #4607

Hi!

If my code is working then it is very simple to fetch the data from the specific record.

write a condition in the query
for example let us assume that you need to fetch a data for the particular user
so your query will be like this

//<code>
global $database, $my;//global declaration
$mydata = $my->id;//fetching the user id who has logged in
if($mydata!=0)
{
$data = mysql_query(\"SELECT * FROM jos_table WHERE id = '\".$my->id.\"' \")
or die(mysql_error());//this query will fetch you the record of that particular user
while($info = mysql_fetch_array( $data ))
{
return $info;//return the name of the user which will be populated in the text filed
}
}
else
{
return 'no record';
}
//</code>


Like wise you can write any complex query and you can fetch the data from the particular record.
Hope this will work let me know when there is any problem.

Note: just paste this code in the default value space for the filed .

Cheers
Ramchandran S
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 8 months ago #4616

Ramchandran you're my hero!!! :cheer:

It works. Thank you very very much for your help.

Adam
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 5 months ago #5635

Hi Ramchandran,

I hope you're still around as I need to humbly ask for your help again - if you don't mind that is.

On the 'WHERE id =' part of the query, do you know if it's possible to automatically enter a form field value? For example, if I have another form field with a value of '12345' is there a way to have the query do 'WHERE id = '12345' ?

I hope that makes sense.

Thanks, in advance, if you can help me with this.
Adam
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 5 months ago #5639

Hi!

It is great pleasure to share Knowledge with others....

The thing you have to use is a AJAX scripting.....

Soon i will send you the code...

Thanks
Ram<br><br>Post edited by: ramchandev, at: 2008/11/19 06:29
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 5 months ago #5669

Thanks for your help Ram. I look forward to seeing the code.

Adam
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 5 months ago #5904

  • gags
  • gags's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hi Ram, if you are around.

I am trying to populate my 'Name' field in my RSform! Pro form from the 'name' field in the normal Joomla 1.5.7 user table, 'jos_users'.
I have taken your code and tried to modify it:

//<code>
global $database, $my;
$mydata = $my->id;//value for fetching the userid
if($mydata!=0)//checking the user is logged in or not.
{
$data = mysql_query(\"SELECT * FROM jos_users \")
or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
return $info;// Name is filed name from the jos_table
}
}
else
{
return 'norecods';
}
//</code>

...but I am getting a lot of errors. Once I get this I would like to do the same with the 'email' field. I am new to PHP but am sure that this is very do-able. Any help appreciated. Thanks
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 5 months ago #5907

Hi! gags

i think your job will get over when you see this page..

www.rsjoomla.com/index.php/rsformpro.cus...ode/Custom-code.html

My code is for Joomla1.0.X
You have worked in Joomla 1.5.7 that is why there are some problems.

Any have let me know if there is any issues.

Regards
-Ram
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 15 years 5 months ago #5908

Adam!

Sorry I am away from my place these days!
Have you solved your problem...
Please Let me know.

-Ram
The administrator has disabled public write access.

Re:Need to grab Juser fields info for RS Forms. 13 years 5 days ago #13600

Hi Adam

I used the code provided in the forum but somehow it is not working can you help me ? Thanks

Daniel
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!