BuddyDev

Search

Ajax Registration with 'Allow Capital Letters In Username' plugin

  • Participant
    Level: Enlightened
    Posts: 89
    Graham Hoffman on #10310

    I’m using the ajax registration plugin but also the Allow Capital Letters In Username, I’m getting an error to show im only allowed lower case, but that isn’t true. any chance you can test/take a look.

    Thanks
    G

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #10311

    Hi Graham,
    Welcome back.

    Can you please point me to the “Allow Capital Letters In Username” plugin.

    I will be happy to make the ajax registration compatible.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 89
    Graham Hoffman on #10324

    https://www.dropbox.com/s/83uimvs1cip56vm/allow-capital-letters-in-username.0.3.zip?dl=1

    Can’t find the link haha – it’s just something I’ve used for a while. Here’s the PHP code (perhaps this is something you want to support.

    ———BEGIN PHP CODE———–

    <?php
    /*
    Plugin Name: Allow Capital Letters In Username
    Version: 0.3
    Plugin URI: http://ru.forums.wordpress.org/topic/3738
    Description: Allows to use uppercase latin letters when registering a new user.
    Author: Sergey Biryukov
    Author URI: http://sergeybiryukov.ru/
    Network: true
    */

    class Allow_Capital_Letters_In_Username {

    function __construct() {
    remove_filter( ‘sanitize_user’, ‘strtolower’ );

    add_filter( ‘wpmu_validate_user_signup’, array( $this, ‘wpmu_validate_user_signup’ ) );
    add_filter( ‘bp_core_validate_user_signup’, array( $this, ‘bp_core_validate_user_signup’ ) );
    }

    function remove_error( $result, $error_string ) {
    if ( empty( $result[‘errors’]->errors[‘user_name’] ) )
    return $result;

    $error_index = array_search( $error_string, $result[‘errors’]->errors[‘user_name’] );

    if ( false !== $error_index ) {
    unset( $result[‘errors’]->errors[‘user_name’][ $error_index ] );

    if ( empty( $result[‘errors’]->errors[‘user_name’] ) )
    unset( $result[‘errors’]->errors[‘user_name’] );
    else
    sort( $result[‘errors’]->errors[‘user_name’] );
    }

    return $result;
    }

    function wpmu_validate_user_signup( $result ) {
    if ( 0 !== strcasecmp( $result[‘user_name’], $result[‘orig_username’] ) )
    return $result;

    if ( preg_match( ‘/[A-Z]/’, $result[‘user_name’] ) )
    $result = $this->remove_error( $result, __( ‘Only lowercase letters (a-z) and numbers are allowed.’ ) );

    return $result;
    }

    function bp_core_validate_user_signup( $result ) {
    $illegal_names = get_site_option( ‘illegal_names’ );

    if ( ! validate_username( $result[‘user_name’] ) || in_array( $result[‘user_name’], (array) $illegal_names ) )
    return $result;

    if ( preg_match( ‘/[A-Z]/’, $result[‘user_name’] ) ) {
    $result = $this->remove_error( $result, __( ‘Only lowercase letters and numbers allowed’, ‘buddypress’ ) );
    $result = $this->remove_error( $result, __( ‘Username must be in lowercase characters’, ‘buddypress’ ) );
    }

    return $result;
    }
    }

    new Allow_Capital_Letters_In_Username;
    ?>

    ——————END——————

  • Participant
    Level: Enlightened
    Posts: 89
  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #10330

    Thank you.

    I will post an update tomorrow.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 89
    Graham Hoffman on #10335

    At the same time – is this pointless if I’m using the Ajax Registration?

    BuddyPress Auto Activate Autologin Redirect To Profile On Signup

    I ask because it says ” The plugin not only registers them but also logs them to the website automatically. This plugin is responsive and works well on mobile devices.”

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #10337

    Hi Graham,
    Both do almost same job. One provides a modal box and another one integrates with the default registration page.

    If you are using the BuddyPress Ajax registration, You don’t need the other plugin.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 89
    Graham Hoffman on #10339

    Any luck with this Brajesh? if not ill remove that plugin for now.

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #10342

    Hi Graham,
    sorry about the delay.

    I will be taking care of it today and post back.

    If possible, please post the code on pastebin.com and link me(or use the backtick(`) character to include the code here.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 89
    Graham Hoffman on #10343

You must be logged in to reply to this topic.

This topic is: not resolved