Here is some fairly simple code for restricting pages only to logged in users in WordPress. Just give me the code | (more…)
Archive for April 5th, 2007
User only/protected pages in WordPress
Thursday, April 5th, 2007AJAX Contact Form with PHP Fallback
Thursday, April 5th, 2007I combined three methods into one overall contact form. It uses an AJAX contact form if people have javascript enabled, and defaults back to the PHP form if they don’t. And it pre-validates the data to warn users about input that will get rejected by the contact form before they submit via javascript.
Note 1, READ THIS!!!!: uses a cookie for the AJAX form so the PHP form will load the first time you hit the page. Hit Reload on your browser to see the AJAX form. Read the full post for reasons why.
Note 2: I do some cursory validation with these scripts mainly to make sure that fields that should be text are text, fields that should be numbers are numbers, and email addresses are actually email addresses. You can easily add additional validation requirements by editing the files.
Note 3: The demo form will not send you the form information you fill out, so please don’t expect to receive anything when you submit it. Because people could use this to send other people unsolicited email by filling out someone else’s email in the form, I set it to send only to me. Sorry.
By all means, download the code and play around with it to see what it does. And please let me know if you find it useful or have questions by filling out the comment form for this post.