Add some user filters.

git-svn-id: http://svn.automattic.com/wordpress/trunk@3800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-05-26 22:47:13 +00:00
parent 70276282ad
commit 1dff136d6f
3 changed files with 54 additions and 2 deletions

View File

@ -93,16 +93,16 @@ function wp_insert_category($catarr) {
$update = false;
$cat_name = apply_filters('pre_category_name', $cat_name);
$category_nicename = apply_filters('pre_category_nicename', $category_nicename);
$category_description = apply_filters('pre_category_description', $category_description);
if (empty ($category_nicename))
$category_nicename = sanitize_title($cat_name);
else
$category_nicename = sanitize_title($category_nicename);
$category_nicename = apply_filters('pre_category_nicename', $category_nicename);
if (empty ($category_description))
$category_description = '';
$category_description = apply_filters('pre_category_description', $category_description);
$category_parent = (int) $category_parent;
if (empty ($category_parent))

View File

@ -54,6 +54,33 @@ add_filter('pre_category_name', 'wp_filter_kses');
add_filter('pre_category_name', 'wp_specialchars', 30);
add_filter('pre_category_description', 'wp_filter_kses');
// Users
add_filter('pre_user_display_name', 'strip_tags');
add_filter('pre_user_display_name', 'trim');
add_filter('pre_user_display_name', 'wp_filter_kses');
add_filter('pre_user_display_name', 'wp_specialchars', 30);
add_filter('pre_user_first_name', 'strip_tags');
add_filter('pre_user_first_name', 'trim');
add_filter('pre_user_first_name', 'wp_filter_kses');
add_filter('pre_user_first_name', 'wp_specialchars', 30);
add_filter('pre_user_last_name', 'strip_tags');
add_filter('pre_user_last_name', 'trim');
add_filter('pre_user_last_name', 'wp_filter_kses');
add_filter('pre_user_last_name', 'wp_specialchars', 30);
add_filter('pre_user_nickname', 'strip_tags');
add_filter('pre_user_nickname', 'trim');
add_filter('pre_user_nickname', 'wp_filter_kses');
add_filter('pre_user_nickname', 'wp_specialchars', 30);
add_filter('pre_user_description', 'strip_tags');
add_filter('pre_user_description', 'trim');
add_filter('pre_user_description', 'wp_filter_kses');
add_filter('pre_user_description', 'wp_specialchars', 30);
add_filter('pre_user_url', 'strip_tags');
add_filter('pre_user_url', 'trim');
add_filter('pre_user_url', 'clean_url');
add_filter('pre_user_email', 'trim');
add_filter('pre_user_email', 'sanitize_email');
// Places to balance tags on input
add_filter('content_save_pre', 'balanceTags', 50);
add_filter('excerpt_save_pre', 'balanceTags', 50);

View File

@ -33,6 +33,7 @@ function wp_insert_user($userdata) {
// Are we updating or creating?
if ( !empty($ID) ) {
$ID = (int) $ID;
$update = true;
} else {
$update = false;
@ -41,15 +42,39 @@ function wp_insert_user($userdata) {
}
$user_login = sanitize_user($user_login, true);
$user_login = apply_filters('pre_user_login', $user_login);
if ( empty($user_nicename) )
$user_nicename = sanitize_title( $user_login );
$user_nicename = apply_filters('pre_user_nicename', $user_nicename);
if ( empty($user_url) )
$user_url = '';
$user_url = apply_filters('pre_user_url', $user_url);
if ( empty($user_email) )
$user_email = '';
$user_email = apply_filters('pre_user_email', $user_email);
if ( empty($display_name) )
$display_name = $user_login;
$display_name = apply_filters('pre_user_display_name', $display_name);
if ( empty($nickname) )
$nickname = $user_login;
$nickname = apply_filters('pre_user_nickname', $nickname);
if ( empty($first_name) )
$first_name = '';
$first_name = apply_filters('pre_user_first_name', $first_name);
if ( empty($last_name) )
$last_name = '';
$last_name = apply_filters('pre_user_last_name', $last_name);
if ( empty($description) )
$description = '';
$description = apply_filters('pre_user_description', $description);
if ( empty($user_registered) )
$user_registered = gmdate('Y-m-d H:i:s');