[pmwiki-users] 2 fox questions

Hans design5 at softflow.co.uk
Thu Sep 20 07:19:46 CDT 2007


Thursday, September 20, 2007, 9:51:49 AM, Hans wrote:


> The filter function will abort the posting if no valid email address
> is provided. To prevent aborting just comment the 'FoxAbort' line in
> the code, then fox will post valid email addresses, and replace any
> non-valid ones with a blank entry.

Or allow postings with no email address, but verify any emaikl address
given, with this code:

# add filter function
$FoxFilterFunctions['FoxVerifyEmail'] = 'FoxVerifyEmailFilter';

function FoxVerifyEmailFilter($pagename, $fields) {
  if(!$fields['email']=="") {
    if(!preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i", $fields['email'])) {
      $fields['email'] = "";
      FoxAbort($pagename, "Please provide a valid email address!");
    }
  }
  return $fields;
}


  ~Hans




More information about the pmwiki-users mailing list