Forums

Need really basic help with CB integration

altoidboy 10 Feb, 2009
I run a Joomla 1.0/CB 1.1 members-only site and now am implementing ChronoForms (latest version) to gather information from users.

So I've written up a form which works fine -- users can type their answers, make their choices, hit send, and it all gets e-mailed to me and logged so it's downloadable. So ChronoForms is working fine.

What I can't figure out - and can't find any tutorials to help me - is how to automatically grab CB fields. Actually only one -- I just want their Name! They are already logged into my site (since it's members-only) so I just want to know who is sending the form, and I want it to be their true full name as recorded in CB.

I already went to the main ChronoForms page, selected my form, and clicked CB Registration. It gave me a list of fields (CB fields), so next to Name field, I filled in "CB_Name" hoping that CB_Name would then turn up in the submissions.

I also clicked on my form, clicked Edit, and on the Plug-ins tab, enabled CB Registration. I also gave it order #1.

This is all just a guess -- I don't know where the real instructions are.

In any case, it doesn't work. Submissions get sent from the site, but do not contain the CB full name.

So how do I do this? I know I'm close.πŸ™‚
Max_admin 10 Feb, 2009
Hi,

you can use the profile plugin in this case, before we can move forward, whats the "name" field is called in your CB config ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
altoidboy 11 Feb, 2009
The name field is simply "name".

Do I use the Profile plugin or the CB Registration plug-in?

Once I activate the Profile plugin, what do I enter for table name, request parameter name, and target field name?

Then, how do I get that info to be logged in both the e-mails that are auto-sent, and in the table database?
Max_admin 11 Feb, 2009
Hi,

#1- the profile plugin
#2- select the jos_comprofiler table and leave the Request name empty and at the target field name select id or user_id, i'm not sure of the field name in the jos_comprofiler table!
#3- just add a hidden field to your form and add the {name} which will get the name value of the logged in user:
<input type="hidden" value="{name}" name="name">


Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
altoidboy 12 Feb, 2009
Tried it, but unfortunately it doesn't work. In the results, all I see is {Name} (with the curly brackets) and not the true user name.

I tried both id and user_id as the target field name. Tried a few other things too. None of these work.

And yes, I did make sure the profile plug-in was enabled in the form.

(BTW this is Joomla 1.0.18, CB 1.2.)
Max_admin 12 Feb, 2009
indeed I don't think the name field in the jos_comprofiler is called only "name" , i remember it was always cb_something, this is case sensitive too, can I see a screenshot for the jos_comprofiler table structure ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 12 Feb, 2009
Hi,

jos_comprofiler has no 'name' field - it does have 'firstname', 'middlename', and 'lastname'

Bob
Max_admin 12 Feb, 2009
Hi Bob,

Thank you, I was also thinking its a bit strange to have only "name" in the CB table!πŸ™‚

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
altoidboy 12 Feb, 2009
Thanks Bob and Greyhead. I have searched and I can't find the true place where names are stored.

I don't believe that firstname, middlename, and lastname are right. They do exist in my database, but I think CB 1.2 might have automatically added them when I upgraded from 1.1, because I've never used those fields in 1.1. (I only upgraded from 1.1 to 1.2 a couple of days ago.) I've always let the user simply enter their full name in one field. So I'm pretty sure that firstname, middlename, and lastname would not contain complete data.

For the life of me, I can't figure out where CB is storing "name". I've looked in all the obvious places.

I've attached screenshots of my jos_comprofiler_xyz databases, and of my field list. Any help is GREATLY appreciated!

Is there any chance CB is storing it in a non-jos_comprofiler area?
altoidboy 12 Feb, 2009
Update! I think I found it! Inside jos_users I see a "name" field that does appear to have a lot of names in it. phpMyAdmin doesn't tell me the total number of names, but it does show me a large number.

Theory: is CB writing these to jos_users so that Joomla recognizes those users (i.e. fools Joomla into thinking they are Joomla users)? For example, when I log into the admin panel of my site, on the right side is a full list of everyone logged in at the moment. So maybe CB writes the users names in this field so as to trick Joomla into thinking they are part of the core Joomla database of users for login purposes.
altoidboy 12 Feb, 2009
Update again (sorryπŸ™‚). I just tried to fill in jos_users and "name" in ChronoForms and then this code into the HTML of the form:

<input type="hidden" value="{name}" name="name">


and it still doesn't work. It doesn't correctly fill in the name.

Any clues now?
Max_admin 12 Feb, 2009
Hi,

I just tried to fill in jos_users and "name"



where ???

you need to choose in the profile plugin "jos_users" and use "id" in the "field name" and then it will work!πŸ˜‰

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
altoidboy 12 Feb, 2009
It works! Thank you so much!

(I was filling in "name" in the field name and it wasn't working, but once I changed that to "id" it worked fine.)

Would it help anyone if I wrote this up cleanly to be posted as a FAQ? I would have thought this would be a fairly common implementation of ChronoForms.
Max_admin 13 Feb, 2009
Hi, Glad that helped and sure it will help much if you told this in details and posted it here or sent me the file!πŸ™‚

Kind regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
altoidboy 15 Feb, 2009
Feel free to copy and paste this (and edit it if necessary) as a FAQ item.

INSTRUCTIONS ON DESIGNING A CHRONOFORMS FORM THAT AUTOMATICALLY GRABS THE USER'S NAME FROM COMMUNITY BUILDER

Tested on a Joomla 1.0.15 site running Community Builder 1.2 and ChronoForms 2.3.9.

Design your form as usual, and in the Form Code tab, inside Form HTML, that's where you write the raw HTML for your form. Somewhere in the form, you must insert:

<input name="name" type="hidden" value="{name}" id="name" >

This will not be seen by the end user.

In the Plugins tab for your form, enable "Profile Page" and give it order "1".

Then in the main ChronoForms page (your form manager), put a checkbox beside your form, and click Profile Page on the left side. You should fill in:

Table name: jos_users
REQUEST Parameter name: (leave blank)
Target field name: id

Save, and that's it!

Note: if a guest comes to your site, or your user isn't logged in, this will not work. I run a members-only site, but provided the direct form link to my members via an e-mail, and found that members clicked on the link in the e-mail, and if they weren't logged in, the form would work but of course would not fill in their name. For this reason, you may want to take the additional step of not sending out the URL of the form, but only posting it in a place where Registered users can see it - this would insure that the form will always grab the name from CB.
GreyHead 15 Feb, 2009
Hi altoidboy,

This is a nice piece of detective work - well done.

And I suspect that the final version has nothing to do with Community Builder as you are getting the names from the standard Joomla #__users table. I think that you'd probably get the same result with this snippet without using the PlugIn
<?php
$user =& JFactory::getUser();
?>
. . .
<input type='hidden' name='name' value='<?php echo $user->name; ?>' />

Bob
altoidboy 15 Feb, 2009
Ah, now you tell me.πŸ™‚

Thanks Bob!
GreyHead 15 Feb, 2009
Hi altoidboy,

Sometimes you don't know where you are going until you get there!
If you need data from CB then your method is great.

Bob
indra2004_id 25 Mar, 2009
Hi GreyHead,

Thanks, your snippet assures me that my method will not cause problem with the rest of component/module/mambot/Joomla core
I worried to use:
$user =& JFactory::getUser();


But now, I feel relieved that the code will not cause problem.
Here what I make to grab data from jos_users & CB (I took name & email from jos_users and I took company from CB i.e. jos_comprofiler):
<?php
$user =& JFactory::getUser();
if ($user->id > 1) { ?>
<div  class="form_item"> 
  <div class="form_element cf_textbox"> 
    <label class="cf_label">Name</label> 
    <input class="cf_inputbox required" maxlength="150" size="38" id="text_1" name="text_1" type="text" <?php echo 'value="'.$user->name.'"' ?>> 
  </div> 
  <div class="clear">Β </div> 
</div> 
<div  class="form_item"> 
  <div class="form_element cf_textbox"> 
    <label class="cf_label">Company</label> 
    <input class="cf_inputbox" maxlength="150" size="38" id="text_2" name="text_2" type="text" value="{cb_companyname}"> 
  </div> 
  <div class="clear">Β </div> 
</div> 
<div  class="form_item"> 
  <div class="form_element cf_textbox"> 
    <label class="cf_label">Email</label> 
    <input class="cf_inputbox required validate-email" maxlength="150" size="38" id="text_3" name="text_3" type="text" <?php echo 'value="'.$user->email.'"' ?>> 
  </div> 
  <div class="clear">Β </div> 
</div>
<?php } else { ?>
<div  class="form_item"> 
  <div class="form_element cf_textbox"> 
    <label class="cf_label">Name</label> 
    <input class="cf_inputbox required" maxlength="150" size="38" id="text_1" name="text_1" type="text"> 
  </div> 
  <div class="clear">Β </div> 
</div> 
<div  class="form_item"> 
  <div class="form_element cf_textbox"> 
    <label class="cf_label">Company</label> 
    <input class="cf_inputbox" maxlength="150" size="38" id="text_2" name="text_2" type="text"> 
  </div> 
  <div class="clear">Β </div> 
</div> 
<div  class="form_item"> 
  <div class="form_element cf_textbox"> 
    <label class="cf_label">Email</label> 
    <input class="cf_inputbox required validate-email" maxlength="150" size="38" id="text_3" name="text_3" type="text"> 
  </div> 
  <div class="clear">Β </div> 
</div>
<?php } ?>

Surely don't forget to activate Profile Page Plugin and use the following parameters:
[list]
  • Table name: jos_comprofiler
  • REQUEST Parameter name:
  • Target field name: user_id
  • [/list]
    The form will be blank whenever the user is not logged in.

    Also don't forget to activate the plugin by going to plugins menu when you are editing the form; Enable the Profile Page by clicking on the box and click the + sign under 1 (number) is shown.
    Sorry, sounds unstructured but I am now in hurry to finish forms for my website.
    This topic is locked and no more replies can be posted.