Categories
Development

Spam Prevention Using Hidden Field

Our site at work has gotten a few pretty intense moments of form spamming over the past few months. Granted a few here and there, we just deal with. However, the really aggressive moments can be quite a nuisance for those receiving all the email submissions.

The big question for us always has been how can we prevent this without being at the expense of the user. For instance, we don’t want a solution that adds more effort to the users and they end up not filling out the form. Not good.

So after some research on suggested approaches I decided to go with the hidden field approach.

This requires adding a field to the form in question, then using some CSS to hide it from view. You can give it a title of do not fill out for those who don’t have CSS enabled in their browser.

Since most spambots tend to fill out every field in a form, you just check if that form has a value when it’s sent. If the bot filled it out, then it’s probably not from a human. If it’s empty, then you’re probably good to send.

We just started testing this approach out, and thus far it’s been good without being too restrictive.

Damn you spammers!

Categories
Development

WordPress 3.5 Add Media button fix

I recently upgraded to WordPress 3.5 and just noticed that the Add Media button was no longer working with my Posts. This isn’t very cool, so I began to look into how to possibly fix and or work around this one.

First I disabled all my plugins, and still the issue was there.

Trusty Google did help me find some people with similar issues.

It seems that my host and how the javascript files are being delivered could be the culprit in this one.

So if you’re hosting your site with Dreamhost and are running WordPress 3.5 and your Add Media button is no longer working you may want to try the following:

Add

define(‘CONCATENATE_SCRIPTS’, false );

in my wp-config.php file just before

require_once(ABSPATH . ‘wp-settings.php’);

That did the trick for me.

Categories
Development

Drupal 7 Only Display 1 Image in Teaser

ok, I was working with a content type with an image field that could hold multiple images (0-4 say). Using the Teaser view mode it would display all the images that were associated with that node, which was really cool in the Default view mode, but not so much the Teaser view mode. I only want it to display 1 image there.

So of course, there’s multiple ways to do this, but I found this approach to be the best for me.

I decided to create and edit an template file in this case since there was enough overall customization going on with this node to warrant such changes. So I created a template file name node–myContentType.tpl.php  based on node.tpl.php and stored in in my theme templates directory.

Easy enough. I then threw in there some crazy text just to make sure I was working with the right template file.

Then I just made the following edits to node–myContentType.tpl.php

if ($view_mode == 'teaser') {
  print render($content['myDemoImage'][0]);
} else {
  print render($content['myDemoImage']);
}

The if statement checks what view mode you are in, if it’s teaser which is the one I want to only display 1 image in then it just renders the first photo in myDemoImage field, else display them all.

That’s it, not too bad. Another reason why I do enjoy working with Drupal.

Categories
Adventure Development

Day of Errors

script errorHad I known ahead of time how this past Tuesday would have unfolded, perhaps I wouldn’t of even gotten out of bed for the entire day.

  1. While working on a site for a client, we have production and testing directories setup on the server. I have been doing web development for over 11 years now, and this setup is pretty standard for me. Well I made a completely idiotic error and decided to delete the files on the production directory. aka I deleted their live website. At this time my stomach dropped to the floor and I began to feel very stupid (it’s a very beginner’s error).
  2. My phone rings at work. Someone is getting hundreds of form submissions as they’re speaking to me on the phone. I hang up and the phone rings again, it’s happening to several co-workers and by the thousands. The most aggressive spambot form attack I can recall by far.
  3. The hard drive on our web server at work dies. The server is down and the hard drive must be rebuilt. This means no website for several hours at the least.
  4. I decide to send out a text alert letting students know that even though our website is down, they can still access other servers, such as their online classes. It turns out that despite being completely branded with no messages stating otherwise, the login for Blackboard has changed from last semester. Now I have to send out a correction text alert. Few things are more embarrassing than a correction text alert.

For any of the above to happen in a work day, would constitute a bad work day. However to pull off all 4 completely unrelated events in a span of 2 hours is truly amazing. While the above is clearly a mix of my error and bad luck, I’m still amazed that all could occur at almost the same time.

It’s a good think I’m a pretty calm guy. I survived the day of course, but wow was I burnt out from all of it.

Categories
Development

visitavalonnj.com

visitavalonnj.comFinished up one of the cooler projects I’ve had the pleasure to work on a few weeks ago. The site is www.visitavalonnj.com.

I’ve worked with the client in the past and they were looking for a new site to help with the tourism of Avalon, NJ (a very nice place). Working with them is excellent and probably the best overall client relationship I’ve had to date. They know what that want, and present a professional design/concept and I build them a web solution to meet their needs.

In this case they really wanted a site that would be easy for them to maintain and add and edit content on a regular basis. Oh yeah, and they also needed it done before the start of their tourism season (middle of March ideally).

With only a few seconds into the conversation I knew that Drupal would be the perfect match for their needs.

Some modules featured in the creation of this project were:

  • Views – while I use it in every Drupal site I’ve ever worked on, it was heavily used in this project and really helped cut down on development time.
  • Calendar and Date – they needed an events calendar and the Calendar module was great to build upon. They also used dates with other content types and the Date module was a real life saver in these cases too.
  • Media – the client wanted the ability to add images inline view a wysiwyg editor. While still not a perfect solution, the Media module did help us give the client such a ability.
  • Facebook OAuth – they wanted users to have the option to login with their Facebook account instead of having to create a separate account for their site. This module was simple to set up and got the job done.
  • Google weather – this allowed us to easily bring in and display the latest weather in Avalon without too much hassle. Just some minor CSS tweaking was involved to get it done.
  • Social media – a very new module and it’s release was most timely. An excellent way to bring the now common social media button onto a website.
  • Webform – again a well known staple that just gets the job done.
  • Omega Theme – a real lifesaver for building a responsive web design. I highly recommend it as a starter theme for any new site.

The whole building block structure of Drupal really allowed us to deliver some cutting edge features without having to start from scratch. This really saved us a great deal in time and costs ($$$) and allowed me to concentrate more of the really unique aspects of the site.

Most impressive was how well the client has been able to use Drupal to manage the site. Our training simply consisted of a few minutes on a phone call. The admin interface was very intuitive to them and I did make sure to label all content types and fields so that each part was clear to them when it came time for them to manage the site.

Again, this was a pretty impressive project and and absolute treat to work with them again! I’m very impressed with it’s outcome and am very excited to check back with it’s performance in a few months.

Lots of fun.

Categories
Development Projects website

Christ Episcopal Church of Somers Point

Christ Episcopal Church of Somers PointA few months ago one of my co-workers, the Admiral told me that her mom’s church was having issues updating their website: http://christchurchsomerspoint.org. Apparently the guy who developed and was assisting them with their site had gotten busy and was no longer able to support them in a timely manner. She asked if I’d be interested in working with them, and I said sure, why not.

My contact Mark came from a tech background. This really made explaining options a breeze and he had a very realistic expectation of what could be expected. He wanted to stick with the current site design and navigation with incorporating a modern CMS (content management system) so that they could manage the site’s content on their own.

After a short meeting and review, it became pretty apparent that Drupal would be a perfect fit for their CMS needs. I gave him a quick Drupal demo and he agreed as well. He was actually very much impressed and excited with what Drupal would offer them out of the box.

I also suggested that they try out Dreamhost for their hosting needs. Dreamhost offers free hosting for non-profits, and free is very hard to beat. I wasn’t sure if the free shared hosting plan would be good enough to support a Drupal site, but thus far it’s been great and looks to be a perfect fit for them.

The majority of their content needs were rather basic, but they did want the ability to upload and share mp3’s of their weekly sermons. Thankfully there were some great modules available that we were able to build upon.

Here’s a list of the modules used by their site:

  • audiofield
  • calendar
  • ctools
  • date
  • entity
  • file_entity
  • libraries
  • media
  • pathauto
  • token
  • views
  • views_slideshow
  • webform
  • wysiwyg

As you can see most are the standard site modules, but the audiofield was a new one to me and really solved the issue of uploading and playing mp3 files. It worked great.

I built the site on the Zen theme, which really made things easy to get started. Just chunked up their existing site into regions and blocks and styled things up from there.

After meeting with them to train them on using Drupal to manage their site, they were extremely pleased and enthusiastic to get started. It really felt great to know that I was able to deliver such and excellent solution for them at a very affordable price. I’m really glad I took on this project and can’t wait to see how well they do keeping content up to date.