Blog » ONW Simple contact v1.2.3

ONW Simple contact v1.2.3

August
31
2009
3:23 pm

New release on the simple contact form.  The new version standardizes the way the bot check image is inserted.  Initially, I had written the src attribute like this:

src="/wp-content/plugins/onw-simple-contact-form/check.jpg"

But that won’t work with people who have a WP installation in a subdirectory of their domain’s root directory. For example, a website (http://www.example.com) has a seperate blog (at http://www.example.com/blog/).  The way I’d written the form initially, the browser will look for an image at http://www.example.com/wp-content/plugins/onw-simple-contact-form/check.jpg when it should be looking in http://www.example.com/wp-content/plugins/onw-simple-contact-form/check.jpg

Then I changed it to

src="./wp-content/plugins/onw-simple-contact-form/check.jpg"

Which fixed the last problem, but only if you have your permalinks set to the ‘ugly’ setting (http://www.example.com/index.php?p=1253), but not if you have them set to look like actual individual pages (like mine do).

So. Now I changed it to look like this:

src="'.get_bloginfo('wpurl').'/wp-content/plugins/onw-simple-contact-form/check.jpg"

Which gets the url of the directory that WordPress is actually installed in and adds the location of the image to it. So now it will work for all different types of installs.

Except those who have moved their wp-content directories.  But I feel that anybody who can do that is a competent enough programmer to just go into the code and change it themselves.

Leave a Reply