thought I'd revive an old thread - hope it works
being a novice at all this and having a very basic understanding of PHP I'm really lost with all these acronyms
CB? CF?
Also I'm trying to use the Dynamic To option in the email template but what PHP code do I put in this field if the form I've created doesn't use an email field? Obviously using the profiler plugin I'd like to draw the users email from their Joomla login. Now I'm sure this is a very easy question for most of you but will all the databases to choose from and a few of them having similar fields I'm lost as to which one to use and also the exact code to place in the Dynamic To field on the email template?
I've looked through all the forums and FAQ entries that deal with emails and the profiler plugin, and there's lots of chunks of PHP and where it should all go, but I'm finding it difficult to break down into which parts I need, and which I need to replace. There doesn't seem to be an idiots guide to setting up the automated emails in ChronoForms. I'm sure it's straight forward for those with PHP and SQL experience. So I apologise for the banality of the post.
Any help is really appreciated.
[[>> Split out from the "CB fields in the emailed CF " thread : greyhead <<]]
I've split your post from the old thread as it doesn't directly connect to CB (the Joomla Community Builder extension).
The Dynamic To field in ChronoForms (CF) takes a field_name from your form, so the trick to using it is to get the email address you want into a field on your form.
For the user's registered email you can do this with a code snippet and hidden form field in your Form HTML:
<?php
$user =& JFactory::getUser(); // get the user info
<input type='hidden' name='user_id' value='<?php echo $user->email; ?> />
Bob
always seems so simple when you lay it out.
Greatly appreciate it.
Cheers
T
So I've placed the code snippet into the HTML form code. But when I go to create a new table the field for the users email doesn't appear and the Add Field button doesn't want to work to allow me to add it to the table.
Do I need to remove the 'hidden' type. Will this allow the field to be included into the table?
My reasoning for this is so that I can use the email address as the primary key, it will also allow me an easy reference when viewing user info.
No doubt I'm going about all this arse backwards so appologies once more.
T
Parse error: syntax error, unexpected '<' in /home8/mycgpimp/public_html/components/com_chronocontact/chronocontact.html.php(320) : eval()'d code on line 68
:?
Sorry I missed a quote in here:
. . .value='<?php echo $user->email; ?>' />
The hidden type shouldn't stop the field appearing in the table list - my typo might have done.
Bob
I should have spotted that.
I'll give it a try now.
Kind regards
T
Is the file chronocontact.html.php supposed to have dual suffix? seems odd but obviously it hasn't bothered my table up till now.
Interestingly if I open the file in Dreamweaver I see this in the visual editor
".$rows[0]->scriptcode); echo "//\n"; echo "\n"; } ?>
".$rows[0]->html ); ?>
Joomla Professional Work
The first line above in bold is line 259 and culminating on line 261 as follows;
eval("?>".$rows[0]->scriptcode);
echo "//</XMLCDATA>\n";
echo "</script>\n";
The second part in bold above is the miscreant line 319 - 320 and appears as this;
eval( "?>".$rows[0]->html );
?>
Now as I've said I'm no PHP coder but the visual feedback seems to be indicating that the quotation marks are leading the PHP to think that the first "?>" is ending the PHP code snippet on both lines?
Line 68 mentioned in the error statement appears to be refering to the following if->else statement, where I've bolded line 67-68
if (dual.length > 1){
el.$tmp.myTitle = dual[0].trim();
el.$tmp.myText = dual[1].trim();
} else {
el.$tmp.myText = el.title;
} el.removeAttribute('title');
Still none the wiser this end I'm afraid but I am trying :?
chronocontact.html.php - with it's double suffix - is all OK, nothing is wrong there.
The error message refers to the code that is being evaluated at line 320 (using the PHP eval() function).
The code that is being evaluated here is the Form HTML and the message tells us that there is an error of some kind on line 68 - of the code in the Form HTML box.
Please take a look around line 68 for a misplaced '<' - or paste the Form HTML here if you prefer.
Bob
PS Which version of ChronoForms are you using - the line numbers here are significantly different from my installation?
thanks for the swift reply.
line 68 in the HTML form code is actually the line of code you gave me to place in there.
<input type='hidden' name='user_id' value='<?php echo $user->email; ?>' />
so unless I've typed something in wrong? or is there a '>' missing for the input command?
Cheers
T
So back to the drawing board (or the forum board as the case may be)
here's the code as it stands
<?php
$user =& JFactory::getUser(); // get the user info
<input type='hidden' name='user_id' value='<?php echo $user->email; ?>' />
Cheers
T
<?php
$user =& JFactory::getUser(); // get the user info
?>
<input type="hidden" name="user_id" value="<?php echo $user->email; ?>">
So I closed the PHP code prior to the input field, and replaced the '/>' with '>' as well as changing all the quotes from single to double.
Any forseeable issues with any of these changes?
Kind regards
T
But on the page after submitting it's telling me that the user has to enter their name??? it's in a red bar at the top of the page, in the same manner as debug script?

I have no idea where this came from. but I assume it's some form of validation?
Something else that is occuring is that the email of the user gained from the jo_user table isn't being registered in my table??? Do I need additional PHP code to do this?
Thanks again
T
That looks like a message from the server-side validation - do you have any code in there?
Hard to say any more without seeing the form code[sendfb][/sendfb]
Bob
:D Ok so first hurdle overcome - it's definitely trying to send the email
But on the page after submitting it's telling me that the user has to enter their name??? it's in a red bar at the top of the page, in the same manner as debug script?
I have no idea where this came from. but I assume it's some form of validation?
Something else that is occuring is that the email of the user gained from the jo_user table isn't being registered in my table??? Do I need additional PHP code to do this?
Thanks again
T
Hi T,
you have a problem with your form code or the registration plugin config, please show us your form code and a screenshot for the plugin config page!
Cheers
Max
thanks for the replies.
Well I have no code in server side validation and no validation settings turned on.
here's my form code:
<DIV class=form_item >
<DIV class="form_element cf_text" >
<p><img src="http://www.mycgpimp.com/images/mycgpimp_signup_03.png" width="585" height="131"></p>
<h3><em><font face="Verdana, Arial, Helvetica, sans-serif">Step 3. Upload
details</font></em></h3>
<p><SPAN class=cf_text ><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Now
we'll take your information and get to work on the tasks you've asked
of us.</font></SPAN></p>
<p><font size="2"><SPAN class=cf_text ><font face="Verdana, Arial, Helvetica, sans-serif">Below
are the options for uploading your CV and/or showreel.</font></SPAN></font></p>
<p><font size="2"><SPAN class=cf_text ><font face="Verdana, Arial, Helvetica, sans-serif">There
is also a space provided for you to enter a professional or personal website
address.</font></SPAN></font></p>
<p><font size="2"><SPAN class=cf_text ><font face="Verdana, Arial, Helvetica, sans-serif">Don't
have an up-to-date CV? No problem.</font></SPAN></font></p>
<p><font size="2"><SPAN class=cf_text ><font face="Verdana, Arial, Helvetica, sans-serif">We've
laid out all the information we need from you in an quick-and-easy form.</font></SPAN></font></p>
<p><font size="2"><SPAN class=cf_text ><font face="Verdana, Arial, Helvetica, sans-serif"><a href="http://www.mycgpimp.com/index.php?option=com_chronocontact&chronoformname=myCGpimp_registration"><strong>Click
here to enter your details.</strong></a></font></SPAN></font></p>
</DIV>
<DIV class=clear ></DIV>
</DIV>
<DIV class=form_item >
<DIV class="form_element cf_text" >
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><SPAN class=cf_text >When
uploading your CV or showreel, please name your file with your firstname
followed by the first two letters of your surname, followed by either
'_cv' or '_showreel'. We can accept pdf, doc, docx, rtf, mov, avi, swf,
files up to 5MB.</SPAN></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">example of file name:
"JohnBe_cv.doc" "JohnBe_showreel.mov"</font></p>
<table width="500" border="0" align="left" cellpadding="2" cellspacing="2">
<tr align="left">
<td width="250"><div class=form_item >
<div class="form_element cf_useruploads" ><font face="Verdana, Arial, Helvetica, sans-serif">
<label class=cf_label ><font size="3">Upload your CV</font></label>
</font></div>
</div></td>
<td width="298"> <div class="form_element cf_useruploads" >
<p><font face="Verdana, Arial, Helvetica, sans-serif">
<input class=cf_inputbox id=user_cv type=file name=user_cv >
<a class=tooltiplink onClick="return false;" ><img class=tooltipimg height=16 src="components/com_chronocontact/css/images/tooltip.png" width=16 border=0 ></a>
</font></p>
</div> </td>
</tr>
<tr align="left">
<td width="250"> <div class="form_element cf_useruploads" ><font face="Verdana, Arial, Helvetica, sans-serif">
<label class=cf_label ><font size="3">Upload your Showreel</font></label>
</font></div></td>
<td width="298"> <div class="form_element cf_useruploads" >
<p><font face="Verdana, Arial, Helvetica, sans-serif">
<input class=cf_inputbox id=user_shwrl type=file name=user_shwrl >
<a class=tooltiplink onClick="return false;" ><img class=tooltipimg height=16 src="components/com_chronocontact/css/images/tooltip.png" width=16 border=0 ></a>
</font></p>
</div> </td>
</tr>
<tr align="left">
<td><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Personal website:
</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif">
<input name="PERSONALWEB" type="text" size="50" maxlength="50">
</font></td>
</tr>
</table>
<?php
$user =& JFactory::getUser(); // get the user info
?>
<input type="hidden" name="user_id" value="<?php echo $user->email; ?>">
<p>Â </p>
<p>Â </p>
<DIV class=clear ></DIV>
<p><font face="Verdana, Arial, Helvetica, sans-serif"><SPAN class=cf_text >
<label class=cf_label ><font size="2">Should you have any further enquiries
please contact us at <a href="mailto:admin@myCGpimp.com">service@mycgpimp.com</a></font></label>
</SPAN></font></p>
<DIV class=clear ></DIV>
</DIV>
<DIV class=form_item >
<DIV class="form_element cf_text" ><font face="Verdana, Arial, Helvetica, sans-serif">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</font></DIV>
<DIV class=clear ></DIV>
</DIV>
</DIV>
and here's a screen shot of my plugins page:
and the Joomla plugin settings I have for the form:

Also, while snooping around for the culprit, I came across this in the CB info for the form. I think I tried linking the form to the CB info at some stage, but I've not filled in any settings on the CB info or on the plugins page for CB.

Kind regards
T
few things to fix and I'm sure it will work for you after that:
#1- remove that "4"
#2- fill all the plugin config fields, look at the Downloads/Chronoforms tutorials/ for how to build a registration page using the plugin, all fields must be filled, the tutorial has a typo, you should use the fields "names" not "ids"
I think this will do it for you, however, I strongly suggest you get RC3 once its out in the next hours!
Cheers
Max
cheers for that.
I'll remove the 4 and leave it blank.
I'm a little confused as to your next suggestion however as I don't actually want to create a new registration form, I merely want to access the Joomla registration email field? Do I still need to fill in all the blanks?
Also, it wouldn't be a proper post without a stupid question, what is RC3?
Cheers
T
RC3 is the latest release of ChronoForms with some bug-fixes and improved features - expected some time tonight all being well.
Bob
RC = Release Candidate, better than beta but still not completely finished.
I'm not clear what you are doing here.
Are these registered users? If so, then you can use the $user code you have in your form to get their email address and you do not need the CF Registration PlugIn.
Do you want to register them? If so, then you can do so with the CF Registration Plugin but you must have all ther fields required for a Joomla Registration - or you must generate values for them (i.e. you could create passwords or usernames automatically).
If they are not registered and you don't want to register them, then you need to pick up the email address from a field in your form.
Bob
Ok, so now I'm back to being really confused.
Yes, they are already registered Joomla users. What I'm trying to do is gather their registered email addresses (from the Joomla registration table) to be stored in my form table, but not visible.
So I understand that the code you gave me will do this? but I assumed I needed to have the Joomla registration plugin set up to allow me to call the info into my table - but from what you're saying I now take it that that is not the case and that I don't need any of this plugin stuff at all?
Yet still the email address of the user still isn't registering in the table, regardless. The column is there but when a user fills in the form and submits the email address isn't being recorded.
So,
do I remove all this plugin stuff (will it leave residual issues?)
and simply use the PHP code calling the users email from the Joomla table?
and then try to figure out why it's not recording along with the other info.
Cheers
T
The Joomla Registration Plugin Is only needed to *do* registrations. So you can un-check it in the registrations tab.
The user email address is always available to you with
<?php
$user =& JFactory::getUser();
echo $user->email;
>?
So rellay it's not good practice to save it again in your table, better to look it up when it's needed.Looking at your form html the email should be saving in the database column titled 'user_id'
Bob
I'll uncheck the plugin.
The table has the column but the emails aren't recording. Any ideas?
Thanks again for all your help. It's very much appreciated.
Kind regards
T
The code snippet I used will just echo the email to the output. You'll need to add it to a form field to have it saved in the database.
Bob