• Кто скажет, почему при регистрации пользователя имя можно писать только на латинице? При русской раскладке пишут «неправильное имя пользователя». Это раз.

    И еще. Можно ли сделать процесс регистрации проще? Без отсылания пароля на почту, а чтобы этот пароль пользователь как-то сам придумывал. Ну короче, чтобы без лишних хождений на другие страницы. Регистрация не должна быть сложной.

Просмотр 12 ответов — с 1 по 12 (всего 12)
  • Модератор Sergey Biryukov

    (@sergeybiryukov)

    Live and Learn

    Дать возможность устанавливать собственный пароль и указывать имя (не логин) на русском можно с помощью плагина Register Plus:
    http://wordpress.org/extend/plugins/register-plus/

    Это же плагин для WP, а мне надо для bbPress. Я его установила, интегрировала WP и bb, но ничего не поменялось.

    Модератор Sergey Biryukov

    (@sergeybiryukov)

    Live and Learn

    Сорри 🙂 Тогда вот: http://bbpress.org/plugins/topic/instant-password/

    Модератор Sergey Biryukov

    (@sergeybiryukov)

    Live and Learn

    Написал плагин для поддержки русских символов в логине. Вроде, заметных проблем на текущей версии это не вызывает. Файл нужно сохранить в UTF-8 под именем allow-cyrillic-username.php и положить в /my-plugins/.

    <?php
    /*
    Plugin Name: Allow Cyrillic Username
    Plugin URI: http://ru.forums.wordpress.org/topic/1424
    Description: Corrects internal bbPress function to support cyrillic characters.
    Author: Sergey Biryukov
    Version: 0.1
    Author URI: http://sergeybiryukov.ru/
    */
    
    function acu_sanitize_user($username, $raw_username, $strict) {
    	$username = strip_tags($raw_username);
    	// Kill octets
    	$username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
    	$username = preg_replace('/&.+?;/', '', $username); // Kill entities
    
    	// If strict, reduce to ASCII for max portability.
    	if ( $strict )
    		$username = preg_replace('|[^a-zа-я0-9 _.\-@]|iu', '', $username);
    
    	// Consolidate contiguous whitespace
    	$username = preg_replace('|\s+|', ' ', $username);
    
    	return $username;
    }
    add_filter('sanitize_user', 'acu_sanitize_user', 10, 3);
    ?>

    ой, при попытке logout вылезает бяка

    Warning: Cannot modify header information — headers already sent by (output started at /home/tvoivyb9/public_html/forum/my-plugins/allow-cyrillic-username.php:1) in /home/tvoivyb9/public_html/forum/bb-includes/backpress/class.wp-auth.php on line 292
    Warning: Cannot modify header information — headers already sent by (output started at /home/tvoivyb9/public_html/forum/my-plugins/allow-cyrillic-username.php:1) in /home/tvoivyb9/public_html/forum/bb-includes/functions.bb-pluggable.php on line 194

    Модератор Sergey Biryukov

    (@sergeybiryukov)

    Live and Learn

    Наверное, это метка BOM. Нужно сохранить без неё 🙂

    И еще вот такая при попытке плагин даективировать

    Warning: Cannot modify header information — headers already sent by (output started at /home/tvoivyb9/public_html/forum/my-plugins/allow-cyrillic-username.php:1) in /home/tvoivyb9/public_html/forum/bb-includes/functions.bb-pluggable.php on line 232

    а кто такая метка BOM?

    Модератор Sergey Biryukov

    (@sergeybiryukov)

    Live and Learn

    Обновил код — можно сохранять и в Windows-1251 🙂 Про BOM написано в первом пункте FAQ.

    Теперь такая бяка:

    Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 6 in /home/tvoivyb9/public_html/forum/my-plugins/allow-cyrillic-username.php on line 18

    Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 6 in /home/tvoivyb9/public_html/forum/my-plugins/allow-cyrillic-username.php on line 18

    Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 6 in /home/tvoivyb9/public_html/forum/my-plugins/allow-cyrillic-username.php on line 18

    Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 6 in /home/tvoivyb9/public_html/forum/my-plugins/allow-cyrillic-username.php on line 18

    Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 6 in /home/tvoivyb9/public_html/forum/my-plugins/allow-cyrillic-username.php on line 18

    Warning: Cannot modify header information — headers already sent by (output started at /home/tvoivyb9/public_html/forum/my-plugins/allow-cyrillic-username.php:18) in /home/tvoivyb9/public_html/forum/bb-includes/functions.bb-pluggable.php on line 232

    Перезалила файл в Adobe Dreamweaver.

    Модератор Sergey Biryukov

    (@sergeybiryukov)

    Live and Learn

    Вернул прежний вариант. Наверное, можно обойтись и без строгой проверки (if ( $strict ) ...), но мне хотелось просто добавить русские буквы и ничего лишнего. BOM можно отключить, например, с помощью редактора Notepad++ (меню Format).

    Ой, Сергей, кажется, у меня все заработало )) Какая прелесть ) Спасибо )

Просмотр 12 ответов — с 1 по 12 (всего 12)
  • Тема «Регистрация» закрыта для новых ответов.