RE: Chronoforms V4

MTP 03 Aug, 2011
Hello,

On Chronoforms V4, are we able to create groups of users.

Example:
Users 1 and 2 work in Office A
User 1
User 2

Users 3 and 4 work in Office B
User 3
User 4

Is there a way when creating a form,in the email settings, that we can send an email to a specific user depending on which office they work at?

If this makes no sense please let me know as it is quite hard to define.

Many Thanks in advance!!!
GreyHead 05 Aug, 2011
Hi MTP,

Yes you can do this, use a Dynamic To in the email set up with say email_to in it.

Then use a Custom Code block to set the value of email_to
<?php
$user = JFactory::getUser();
// then get the User Group(s) - I don't know what this code is without looking it up
switch ( $user_group ) {
  case 'group_1':
    $form->data['email_to'] = 'some_user@example.com';
    break;
  case 'group_2':
    $form->data['email_to'] = 'some_Other_user@example.com';
    break;
}
?>

Bob
MTP 05 Aug, 2011
Hi,

Thanks for the coding. I just have one question about where it goes.

I am a little confused as I have some other coding that you have shown me in the Custom Code area already. Do I erase that coding with the above coding you have given me or can they both be put together as I want the above code to be put in the CC of the email on the form.

As I want the user to select their manager and whichever manager they select will send an email to the manager and CC to the managing partner of the office the manager is in if this makes sense?

Many Thanks again!
GreyHead 06 Aug, 2011
Hi MTP<

You can put more than one piece of code in a Custom Code action; or you can add a second Custom Code action if you prefer to keep them separate.

You can use the same approach to set a Dynamic CC value.

Bob
MTP 05 Sep, 2011
Hello,

Thank you for the reply.

I was wondering on this coding:

    <?php
    $user = JFactory::getUser();
    // then get the User Group(s) - I don't know what this code is without looking it up
    switch ( $user_group ) {
      case 'group_1':
        $form->data['email_to'] = 'some_user@example.com';
        break;
      case 'group_2':
        $form->data['email_to'] = 'some_Other_user@example.com';
        break;
    }
    ?>


in this part -['email_to'] is that where I put the email addresses of the group of users in the office?

Sorry about this I dont understand how and where you input the email addresses.

Thanks,
MTP
GreyHead 05 Sep, 2011
Hi MTP,

That will work with a single email address, I'm not sure if it works with a list of email addresses. There is another thread here that talks about that.

Bob
MTP 05 Sep, 2011
Hi,

thanks for the reply.

Whereabouts do the email addresses go in the code such as this:

(User 1 - submits form to manager)
(user 2 - manager)

case 'Group1':
$form->data['email_to'] = [email]'some_Other_user@example.com[/email]';
break;

Does the user 1 email address go in the email to box?

Sorry i dont understand much coding.

Thanks
MTP
GreyHead 05 Sep, 2011
Hi MTP,

If I understand what you are asking then email_to would go in the Dynamic To box in the Email setup.

Bob
MTP 07 Sep, 2011
Hi,

Thanks for the reply.

I have inserted the coding etc like you said and the grouping emails did not work.

Is there something I am doing wrong?

Thanks,
MTP
Max_admin 09 Sep, 2011
Hi MTP,

Based on Bob's code, you should have the string "email_to" in the "Dynamic To" field of your email AND you should have some field in your form passing the values "group_1" or "group_2".

You should also test your form first with a regular dynamic to field to make sure its emailing fine.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
MTP 09 Sep, 2011
Hi,

Thanks for the reply.

I have the email to in the dynamic to box but I dont have group coding in my form as I didnt know I needed that.

How do I create a group field in my form?

Sorry for all the questions.
Thanks,
MTP
Max_admin 09 Sep, 2011
Hi MTP,

Maybe you should have a dropdown (select box), give it the field name it "group", add 2 options:

group_1=Group 1
group_2=Group 2

And in bob's code, replace
switch ( $user_group ) {
with
switch ( $form->data['group'] ) {


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
MTP 12 Sep, 2011
Hi,

Thanks for the reply.

I have added the group coding etc and still the emails to the group email do not work.

Is there anything else I can do?

Thanks,
MTP
GreyHead 15 Sep, 2011
Hi MTP,

Hard to see where you've got to with this.

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
MTP 15 Sep, 2011
Hi,

Thank you for the reply. Thank you for the help that you and Max have given. I finally figured it out in the end and I got it to work.

Sorry for the late reply.

Thank you very much for your help and Max!

Thanks again,
MTP
This topic is locked and no more replies can be posted.