Contact Form

General plugins (Local) ::: local_contact
Maintained by Michael Milette
Contact Form is a Moodle plugin that allows your site to process and send information submitted through HTML web forms to the site's support email address or primary administrator if the support email address is not defined.
Latest release:
5461 sites
1k downloads
99 fans
Current versions available: 1

The Contact Form plugin for Moodle processes information submitted through a custom web form, sending it by email to the site's support email address, if defined, or to the primary system administrator.

Examples uses for this plugin include:

  • Contact us form.
  • Support request form.
  • Request a course form.
  • Information request form.
  • Lead generation form.
  • Membership application form.

Share with us how you use this plugin on your site.

Note: This is not a web form builder but a form processor. You must have some knowledge of how to create HTML forms or at the very least be able to cut and paste the example included in the README file.

Contact Form templates

If you are not familiar with HTML, consider using the following easy to use plain text {form...} tags included with the FilterCodes plugin. These will generate a Contact Form templates and therefore require that you have the FilterCodes plugin installed and activated.

  • {formquickquestion} : Adds a "quick question" form to your course. Form includes Subject and Message fields. Note: User must be logged in or the form will not be displayed.
  • {formcontactus} : Adds a "Contact Us" form to your site (example: in a page). Form includes Name, Email address, Subject and Message fields.
  • {formcourserequest} : Adds a "Course Request" form to your site (example: in a page). Unlike Moodle's request-a-course feature where you can request to create your own course, this tag allows users to request that a course they are interested in be created. Could also be used to request to take a course. Form includes Name, Email address, Course name, Course Description.
  • {formsupport} : Adds a "Support Request" form to your site (example: in a page). Form includes Name, Email address, pre-determined Subject, specific Subject, URL and Message fields.
  • {formcheckin} : Adds a "I'm here!" button to your to your course. Form does not include any other fields. Note: User must be logged in or the button will not be displayed.

The initial work for this project was sponsored by the kind folk at l'Action ontarienne contre la violence aux femmes. Contact Form benefits from ongoing development by TNG Consulting Inc..

Potential privacy issues

Reminder: Email message protocols may cross the Internet and store messages on mail servers in unencrypted plain text. If you are sending messages outside of your local area network, it is highly recommended that you do not use this plugin to collect sensitive information such as social insurance or credit card numbers. It has nothing to do with this plugin's functionality but just with the way email protocols work. This plugin on its own does not store any information - anywhere.

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

Michael Milette (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Philippe Baumann
    Tue, 9 May 2023, 12:50 AM
    Hi Michael,
    I'm doing my first steps with your plugin. Is there a way to send the content of the form to the user, who send this form, too?
    thanks in advance.
    regards,
    Philippe
  • Michael Milette
    Thu, 11 May 2023, 9:10 PM
    Hi Phillipe, not yet. However, please submit a feature request at https://github.com/michael-milette/moodle-local_contact/issues
  • Michael Milette
    Fri, 20 Oct 2023, 11:43 PM
    Contact Form 1.3.0 has arrived! This latest release adds the ability to process and attach an an uploaded file to the email. This release is also compatible with Moodle 4.3.

    Hope you find it useful.

    Best wishes to you all!

    Michael Milette
  • Pedro Garcia
    Mon, 30 Oct 2023, 9:58 PM
    Hello,
    is it possible to load categories and courses without any big code change in this form?
  • Michael Milette
    Tue, 31 Oct 2023, 1:04 PM
    Hi Pedro,

    You can put anything you want in the HTML of the form. The creation of the form is up to you. That is not part of this plugin.

    The Contact plugin is just a webmail form processor that takes whatever you submit from a form and delivers that information by email.

    So, feel free to load the form with a list of courses or categories in a dropdown field. Whichever the user picks will be delivered in the email.

    Best regards,

    Michael
  • Halie Carton
    Thu, 23 Nov 2023, 12:27 AM
    Hi Michael,

    With the 4.3 update, are users that are not logged into Moodle still able to fill out a contact form made with this plugin?

    Sincerely,
    Halie Carton
  • Michael Milette
    Thu, 23 Nov 2023, 1:10 AM
    Hi Halie,

    Contact Form does not create the form. You need to do that in HTML or using one of the {form...} template tags included with FilterCodes. Whether or not a user has access to the form depends on where you put the form and what access a person has to that block or page on the site. Are you experiencing an issue specifically with 4.3 or is this just a general enquiry?

    Best regards,

    Michael
  • Halie Carton
    Thu, 23 Nov 2023, 1:32 AM
    Thanks Michael!

    This question is specifically for 4.3. We want users to be able to contact us if they have an issue from the Login page, without having to sign in. Moodle has apparently increased security with this latest version (which is good) but according to our Moodle Admin, the increased security means that users can't no longer access the support form from the Login page without signing in. He's currently storing the support form on our site using Static Pages. He created the form using Filter Codes. He's also said that with Moodle 4.3, we aren't able to embed external links into the Login page (for security reasons).

    I'm trying to better understand the issue so I can offer an alternative option. What do you think?

    Thank you for your time.

    Sincerely,
    Halie Carton
  • Michael Milette
    Thu, 23 Nov 2023, 5:46 AM
    Hi Halie,

    I see the problem. Fortunately, there is an easy solution but you will need to install the very useful FilterCodes plugin to do it.

    1. Install and activate FilterCodes: https://moodle.org/plugins/filter_filtercodes

    2. In FilterCodes' settings, add your form's HTML code to create a {global_...} tag. Save.

    3. In your login form, add the {global_...} tag that you created in the previous step. Be sure that the "Pretty HTML format" box is unchecked. Save.

    And voila, your fully functional form should now be embedded in your login page. You can do the same thing if you want to insert a link instead of the full form.

    If you want to take this to the next level, integrate this with a little HTML for a Bootstrap modal form:
    https://getbootstrap.com/docs/4.3/components/modal/

    You could then potentially just add an "I can't log in" button to the login page and then have a "Contact support" form pop-up as a modal box.
    Here is a screenshot:

    Hope you find this information helpful.

    Best regards,

    Michael Milette
  • Halie Carton
    Thu, 23 Nov 2023, 6:08 AM
    Thank you so much, Michael.

    Sincerely,
    Halie Carton
  • Mustafa Hajjar
    Mon, 29 Jan 2024, 11:33 AM
    Hi there,

    I am having problems getting through the '' error. I used both methods the easy FilterCodes and the Custom method using the first example in the README. Both methods display the form fine and both result in the error. I added the referrer script & input as instructed in the README and I tried both ../.. and {wwwroot}.
    I am on Moodle 4.2.2

    I tried posting the code but the forum is rendering the form here! I tried switching my profile preference to 'Plain test area' editor but Moodle Forum still renders the form!

    Thanks,
    Mustafa
  • Michael Milette
    Mon, 29 Jan 2024, 2:14 PM
    Hi Mustafa,

    I confirmed that this works fine in Moodle 4.2.2 using the latest release of Contact Form. So, here are some troubleshooting steps for you:

    1. If you are using FilterCodes, first confirm that FilterCodes (https://moodle.org/plugins/filter_filtercodes) works without a form. If it does not, please see the FAQ/troubleshooting section in the documentation (README.md file).

    2. If FilterCodes is working, please enter the {filtercodes} tag. This will display the version of FilterCodes that you are using. Then, make sure that you are using the most recent version.

    3. Once you have that working, enter the following tag: {formquickquestion}. When the page displays, you should see a form. Fill it out and submit the information. If the message was submitted successfully, ensure that you received the message by email. If you did not, please use the Email Test plugin (https://moodle.org/plugins/local_mailtest) to troubleshoot.

    4. If that worked, then the problem is with the HTML of the form that you created. To get help in the discussion forums, save your HTML code for the complete form to a text file (not HTML or PHP) and attach it to your message. In the body of the message, be sure to include any error messages as well as the name of the Moodle theme you are using and where you are trying to use it (e.g. a block, a page, a lesson, etc).

    Reminder: You can always post screenshots in the discussion forums. But please don't do this with your form. Nobody wants to type all that in.

    I hope you find this information useful.

    Best regards,

    Michael Milette
  • Michael Milette
    Mon, 29 Jan 2024, 2:41 PM
    Hi again Mustafa,

    I checked the HTML of your form. The problem with setting the form action to something that starts with ../../ is that this is a relative path. It will work in some places, like on a page within your course, but not in others, like your course main page/outline. To make it work on the course main page, you can replace it with ../../ with simply ../ . If you can always remember to specify the correct relative path, this works just as well as using the FilterCodes {wwwroot} except in a block that appears in multiple locations. Then it depends on the where it is relative to the web root of your site.

    Here are a couple of solutions that will work consistently:

    1. Specify the full path. Example:

    action="https://example.com/local/contact/index.php"

    2. If FilterCodes is working for you, you can use {wwwroot}. This has the advantage that, if you move your course to a different Moodle site that has FilterCodes installed (like a local copy), the path will still work. Example:

    action="{wwwroot}/local/contact/index.php"

    If that doesn't work for you either, check the config.php file of your Moodle site and make sure that there is no forward slash at the end of the $CFG->wwwroot line. Example:

    Will not work if:

    $CFG->wwwroot = 'https://yourmoodlesite.org/';

    Must be like this:

    $CFG->wwwroot = 'https://yourmoodlesite.org';

    I tested the rest of your form and it works in Moodle 4.2.2 if you fix the form's action path.

    For more Contact Form troubleshooting information, please see https://github.com/michael-milette/moodle-local_contact/blob/master/README.md#why-isnt-my-form-working

    Best regards,

    Michael Milette
  • Mustafa Hajjar
    Sat, 3 Feb 2024, 10:32 PM
    Hi Michael,

    You must be referring to a different discusison forum, the on in the Useful Links here seems to be locked (https://moodle.org/mod/forum/discuss.php?d=352851).

    I double checked everything and the code and Moodle configs seem to be fine (wwwroot no trailing forward slashes). My problem is environment specific as the same code works fine on dev (nginx/https) but not in test or prod. Also, the issue is not browser-related as I tested on few browsers on different machines with the same results (dev success, test/prod fail).

    After digging further, I think the HTTP_REFERER tag is getting stripped along the way, I wonder if it is related to Cloudflare services, which we use. The code checks if there is no HTTP_REFERER tag, then the request is considered coming from spambot, which is not the case here.

    I configered the contact form plugin to require login, and the same on the moodle page it is called from (no guest access).

    Best,
    Mustafa
  • Simon Carr
    Fri, 26 Apr 2024, 5:16 AM
    Hi,
    I am having issues with not getting the Message sent page. After the contact us form is filled and I am using filter plugin, the information from the form is sent to the email address but the user is unable to see the Message Sent page or message. So user won't know whether the message was submitted or not.

    Grateful if anyone can shed some light on this as to whether I am missing something.

    Steps I have taken -
    create a Page activity, add the custom html block & add the contact-us filter code.
1 2 3 4 5 6 7 8 9 10
Please login to post comments