Drupal 7 ContactPlus Module

By shane
Wed, 2014-04-30 07:38
Daily Dose of Drupal Episode #145

Share with Others

The Drupal 7 ContactPlus module is a simple module that adds extra features to the core Drupal contact module.

Hello everyone and welcome to another Daily Dose of Drupal. This is Shane Thomas and today we’re going to be going over a very simple module that basically enhances the Core Drupal Contact Form Module or the Contact Module.

The module that we’re going to be going over today is called Contact Plus and you might want to use this if you are either frustrated by the limitations of Core Drupal Contact Form and you don’t want to use a web form.

A lot of people like to use web forms for the contact forms because it’s a little easier to build out depending on what fields you need. However there are other problems with using the web form especially if you want to use a development in a staging environment and pushing changes between those with web form is a little bit more difficult.

So the Contact Plus kind of sits in the middle there, it’s not as flexible as web form but it does add a few extra features to the Core Drupal Contact Module. So if you open up our test site here you can see we have a Contact Form and this is just what you get out of the box. I have two contact categories and this is just a very basic Contact Form that comes with Drupal by installing the Contact Module.

So if I hop over to our module’s page you’ll see I have the contact module that comes with Drupal Core and I also have a Contact Plus Module. I’m using the Dev version because there was a recent release and I fixed a few minor bugs. So I’ll go ahead and turn this on and we’ll see what we can do. If you look at the Drupal.org page for Contact Plus it tells you it does a few things.

It allows you to set a custom redirect path after you submit a Contact Form which can be nice because default I believe Drupal just send you to the front page and you can also hide or disable specific form elements on the Contact Form. And that’s really all there is to it, it’s pretty simple so we’ll go ahead and take a look. We’ll first start by looking at just our normal contact configuration settings.

So as you can see I have two categories here, I could add more but if I edit one of these categories you’ll notice that I have a redirect path for this category. So I could redirect to any path besides the front page or if you’d leave it blank it’s just going to default to the front page there.

That’s the only difference on when you’re editing a specific contact category. It’s just this redirect path. The one other thing that this Contact Plus Module gives you if you come back you can find the configuration page for Contact Plus is it gives you some additional settings to alter the name fields.

You can also add some introduction text at the top s if I want to add some extra text at the top of the contact form I can of course use full HTML or filtered HTML to add images or anything else that I might need. We’ll go ahead and take a look at this and we’ll come back and look at this other fields. So if I refresh my contact form you’ll notice that a couple of my fields went away and I also have text at the top here. So this is useful if you want to have a little more flexibility in designing out your contact form on your website.

So let’s look at these fields; first is the Alter Name Field; these two fields here, the Alter Name field and the Alter Send from Address can be useful when working with authenticated users. So user who’s already going to have their name or their e-mail address in the system so if I go back to the defaults here you’ll notice it’s pretty much back to normal. I can see that I have my name, my e-mail address, I have the Send Yourself a Copy checkbox but getting rid of it is a s easy as saying “I want to hide the fields completely” but only if it already has a value.

Of course there’s other options here depending on if you’re typically getting contact submissions from authenticated or anonymous users. You can do the same from the e-mail address, I can even remove the subject and a copy fields. If I come to the contact form now you can see it’s much simpler, cleaner, I can have my text on top, I can still select the category, I can still submit the contact form. Of course this time it took me to the front page but if I wanted it to take me to another page let’s say I wanted it to take me to the User Page.

I simply come in here to my contact form and we’ll say if I select General Information I want it to go to the User Page, if I go back to the Contact Form and select General Information, submit it, that will be taken to the User Page instead of the Home Page. So that’s it, pretty simple module, it can definitely be helpful if you just have a simple site with needing a simple Contact Form but the Core Drupal Contact Form Module just isn’t flexible enough.
So go ahead and give it a try and let me know what you think and make sure to sign up to the Code Karate Newsletter and follow me on Twitter at smthomas3, until next time, see you.