I am new to wordpress and I am just learning it.
How to hook validate_username or sanitize_user functions?
I do not want to call them at all, I want to change them for my particular plugin.
Here is the full story:
My problem is that I do not know how to change existing WP functions correctly without modifying them (some hooks or something like this).
I have the following problem:
- I have a plugin theme-my-login that shows registration form
- it has register_new_user (that handles registering a new user) -> it is not wp standard function, but is written in plugin
-
this function calls WP standard validate_username:
function register_new_user( $user_login, $user_email,$term, $country ) { $errors = new WP_Error(); $sanitized_user_login = sanitize_user( $user_login ); $user_email = apply_filters( 'user_registration_email', $user_email ); // Check the username if ( $sanitized_user_login == '' ) { $errors->add( 'empty_username', __( '<strong> ط®ط·ط£ </strong>...', 'theme-my-login' ) ); } elseif ( !**validate_username**( $user_login ) ) { //HERE WE CALL WP VALIDATE_ $errors->add( 'invalid_username', __( '<strong> ط®ط·ط£ </strong>:….
So, the problem here is that *validate_username* doesn’t allow usernames to be in arabic language. But this is what client wants.
So, I believe I should overwrite or somehow modify existing WP validate_username or sanitize_user (both are in wp-includes/user.php).
I have found a plugin that does everything for me:
“WordPress Special Characters in Usernames”
http://wordpress.org/extend/plugins/wordpress-special-characters-in-usernames/