[wp-trac] Re: [WordPress Trac] #2541: Filter hook for checking registration information

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 7 07:57:23 GMT 2006


#2541: Filter hook for checking registration information
-------------------------+--------------------------------------------------
       Id:  2541         |      Status:  assigned                
Component:  General      |    Modified:  Tue Mar  7 07:57:23 2006
 Severity:  minor        |   Milestone:  2.1                     
 Priority:  normal       |     Version:  2.0.1                   
    Owner:  markjaquith  |    Reporter:  thefreefood             
-------------------------+--------------------------------------------------
Changes (by markjaquith):

  * milestone:  2.0.2 => 2.1
  * keywords:  registration register filter hook => registration register
               filter hook has-patch 2nd-opinion
  * status:  new => assigned
  * owner:  anonymous => markjaquith

Comment:

 Agreed on the usefulness of this.

 I whipped up a quick patch.  The e-mail is passed through
 user_registration_email filter.  The $errors array is passed through
 registration_errors filter.

 So something like:


 {{{
 function user_emails_on_my_domain($email) {
         if ( strpos($email, '@mydomain.com') === false ) { // obviously
 use a better check than this!
                 add_filter('registration_errors',
 create_function('$errors=array()', '$errors[\'user_email\'] =
 \'<strong>ERROR</strong>: This email does not end in "@domain.com"\';
 return $errors;'));
         }
         return $email;
 }

 add_filter('user_registration_email', 'user_emails_on_my_domain');

 }}}

 Untested, but you get the idea.  Going to have to be a 2.1 milestone.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2541>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list