Accessing multiple database tables

dbirchmier 02 Oct, 2008
Hello everyone,

First off -- Chronoforms is an absolutely fantastic product. I'm grateful someone took the time to produce and share this functional software.

I have a question, regarding how to access multiple tables and draw data from them at once.

I'll layout how the process works:

1)User visits website (<!-- w --><a class="postlink" href="http://www.censorednation.com">www.censorednation.com</a><!-- w -->) and registers through community builder. Community builder is setup with additional fields such as -- such as "mailing address, city, state, zip etc.)

2) Upon registration they are taken to a new screen which allows them to fill out a Chronoforms form

3)This form pulls the {username}, {name}, and {email} field in a hidden fashion -- the values of these fields are SENT OUT via email

In order to make step 3 work, I enabled the profile page plugin, then I selected "jos_users" > "ID"

Now I'd also like to pull data from the COMMUNITY BUILDER fields. Such as "jos_comprofiler" > "ID"
The community builder fields are the ones that contain the address and the like. Is there anyway to allow data to be pulled from BOTH of these tables?

I'm relatively new at this...so I appreciate any advice you can give me.

If I have been unclear in anyway, just let me know🙂

Thanks again for the help.
GreyHead 02 Oct, 2008
Hi dbirchmier,

Most of the jos_user info is available from the 'user' object, you can access these directly in your form code and then use the profiler plugin for the Community Builder table.
<?php
$user =& JFactory::getUser();
?>
<p>Welcome <php? echo $user->name; ?></p>
<p>Your email is <php? echo $user->email; ?></p>


Bob

Later: changed to use JFactory instead of $user =& JUser::getInstance();
dbirchmier 02 Oct, 2008
Dear Bob,

Thanks so much for the prompt response!

By using:
<?php
$user =& JUser::getInstance();
?>


Could I then call the "$user" variable in the email template section. I need to echo it when the email is sent. Will this work?

Thanks again!
Max_admin 02 Oct, 2008
Yes!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 02 Oct, 2008
Hi dbirchmier,

As Max says it will work there (or anywhere else).

You may find it simpler to use hidden fields to set the user values in the form html.
<input type="hidden" name="email" value="<?php echo $user->email; ?>" ?>

You can then access them in the template using the CF {field_name} syntax.

Bob
dbirchmier 02 Oct, 2008
Wow.

You guys are beyond great. Thanks so much!

I'll try this tonight. Sounds like the perfect solution.

Where's the donate button?
Max_admin 02 Oct, 2008
Hi dbirchmier, Thank you, we don't have a donate button, you can support us in 2 ways, you can get a license from the link at the top of all pages, you can also vote/review Chronoforms at the Joomla site from the link in my signature because this helps us go up in listings.

Regards

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dbirchmier 03 Oct, 2008
Okay! I've rated the product.

Thanks again guys!
dbirchmier 03 Oct, 2008
Hey guys,

I've added the following code to the top of my "Form HTML:
(may contain PHP code with tags)" section:

<?php
$user =& JUser::getInstance();
?>
<p>Welcome <php? echo $user->name; ?></p>
<p>Your email is <php? echo $user->email; ?></p>


However when viewing the form, I don't see my name/email echoed. (I've checked to assure I'm logged in)

Any ideas?
Max_admin 03 Oct, 2008
Thanks! try to use :

$user = JFactory::getUser();


instead of :
$user =& JUser::getInstance();


Regards

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 03 Oct, 2008
Hi dbirchmier,

Are you logged in to the Front-end when you check this?

If there is no user logged in then $user will be empty, as Joomla has no way of knowing who is there.

Logging in the back end as administrator is not enough, you must log in the front-end as well.

ob
dbirchmier 06 Oct, 2008
hey there,

I am logged in through the front end, and I tried including this code at the top of my form to test:

<?php
$user = JFactory::getUser();
?>
<p>Welcome <php? echo $user->name; ?></p>
<p>Your email is <php? echo $user->email; ?></p>



However the form outputs:

Welcome name; ?>

Your email is email; ?>



I am definitely logged in to the front end, and the name variable is set for the user. Any other ideas?
Max_admin 06 Oct, 2008
Hi, catch typo, this :
<php?


should be
<?php


cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.