Skip to:
Content

BuddyPress.org

Ticket #5914: 5914.01.patch

File 5914.01.patch, 7.7 KB (added by r-a-y, 10 years ago)
  • src/bp-blogs/bp-blogs-template.php

     
    12231223        if ( !is_subdomain_install() )
    12241224                echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span> <input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63" /><br />';
    12251225        else
    1226                 echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63" /> <span class="suffix_address">.' . bp_blogs_get_subdomain_base() . '</span><br />';
     1226                echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63" ' . bp_get_form_field_extra_attributes( 'blogname' ) . '/> <span class="suffix_address">.' . bp_blogs_get_subdomain_base() . '</span><br />';
    12271227
    12281228        if ( !is_user_logged_in() ) {
    12291229                print '(<strong>' . __( 'Your address will be ' , 'buddypress');
  • src/bp-core/bp-core-template.php

     
    492492}
    493493
    494494/**
     495 * Output the extra attributes for a form field.
     496 *
     497 * @since BuddyPress (2.2.0)
     498 *
     499 * @param string $type The field type to output attributes for.
     500 */
     501function bp_form_field_extra_attributes( $type = '' ) {
     502        echo bp_get_form_field_extra_attributes( $type );
     503}
     504        /**
     505         * Get the extra attributes for a form field.
     506         *
     507         * Primarily to add better support for touchscreen devices, but plugin devs
     508         * can use the 'bp_get_form_field_extra_attributes' filter for further
     509         * manipulation.
     510         *
     511         * @since BuddyPress (2.2.0)
     512         *
     513         * @param string $type The field type to get attributes for.
     514         */
     515        function bp_get_form_field_extra_attributes( $type = '' ) {
     516                $retval = '';
     517                $attributes = array();
     518
     519                switch ( $type ) {
     520                        case 'slug' :
     521                        case 'username' :
     522                        case 'blogname' :
     523                                $attributes['autocomplete']   = 'off';
     524                                $attributes['autocapitalize'] = 'none';
     525                                break;
     526
     527                        case 'email' :
     528                                if ( wp_is_mobile() ) {
     529                                        $attributes['autocapitalize'] = 'none';
     530                                }
     531                                break;
     532
     533                        case 'password' :
     534                                $attributes['spellcheck']   = 'false';
     535                                $attributes['autocomplete'] = 'off';
     536
     537                                if ( wp_is_mobile() ) {
     538                                        $attributes['autocorrect']    = 'false';
     539                                        $attributes['autocapitalize'] = 'none';
     540                                }
     541                                break;
     542                }
     543
     544                /**
     545                 * Filter the attributes for a field before rendering output.
     546                 *
     547                 * @since BuddyPress (2.2.0)
     548                 *
     549                 * @param array  $attributes The field attributes
     550                 * @param string $type       The field type
     551                 */
     552                $attributes = apply_filters( 'bp_get_form_field_extra_attributes', $attributes, $type );
     553
     554                foreach( (array) $attributes as $attr => $value ) {
     555                        $attr  = sanitize_title( $attr );
     556                        $value = esc_attr( $value );
     557                        $retval .= " {$attr}=\"{$value}\"";
     558                }
     559
     560                echo $retval;
     561        }
     562
     563/**
    495564 * Create and output a button.
    496565 *
    497566 * @see bp_get_button()
  • src/bp-templates/bp-legacy/buddypress/members/register.php

     
    3131
    3232                                <label for="signup_username"><?php _e( 'Username', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
    3333                                <?php do_action( 'bp_signup_username_errors' ); ?>
    34                                 <input type="text" name="signup_username" id="signup_username" value="<?php bp_signup_username_value(); ?>" />
     34                                <input type="text" name="signup_username" id="signup_username" value="<?php bp_signup_username_value(); ?>" <?php bp_form_field_extra_attributes( 'username' ); ?>/>
    3535
    3636                                <label for="signup_email"><?php _e( 'Email Address', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
    3737                                <?php do_action( 'bp_signup_email_errors' ); ?>
    38                                 <input type="email" name="signup_email" id="signup_email" value="<?php bp_signup_email_value(); ?>" />
     38                                <input type="email" name="signup_email" id="signup_email" value="<?php bp_signup_email_value(); ?>" <?php bp_form_field_extra_attributes( 'email' ); ?>/>
    3939
    4040                                <label for="signup_password"><?php _e( 'Choose a Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
    4141                                <?php do_action( 'bp_signup_password_errors' ); ?>
    42                                 <input type="password" name="signup_password" id="signup_password" value="" class="password-entry" />
     42                                <input type="password" name="signup_password" id="signup_password" value="" class="password-entry" <?php bp_form_field_extra_attributes( 'password' ); ?>/>
    4343                                <div id="pass-strength-result"></div>
    4444
    4545                                <label for="signup_password_confirm"><?php _e( 'Confirm Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
    4646                                <?php do_action( 'bp_signup_password_confirm_errors' ); ?>
    47                                 <input type="password" name="signup_password_confirm" id="signup_password_confirm" value="" class="password-entry-confirm" />
     47                                <input type="password" name="signup_password_confirm" id="signup_password_confirm" value="" class="password-entry-confirm" <?php bp_form_field_extra_attributes( 'password' ); ?>/>
    4848
    4949                                <?php do_action( 'bp_account_details_fields' ); ?>
    5050
  • src/bp-templates/bp-legacy/buddypress/members/single/settings/general.php

     
    55        <?php if ( !is_super_admin() ) : ?>
    66
    77                <label for="pwd"><?php _e( 'Current Password <span>(required to update email or change current password)</span>', 'buddypress' ); ?></label>
    8                 <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" /> &nbsp;<a href="<?php echo wp_lostpassword_url(); ?>" title="<?php esc_attr_e( 'Password Lost and Found', 'buddypress' ); ?>"><?php _e( 'Lost your password?', 'buddypress' ); ?></a>
     8                <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" <?php bp_form_field_extra_attributes( 'password' ); ?>/> &nbsp;<a href="<?php echo wp_lostpassword_url(); ?>" title="<?php esc_attr_e( 'Password Lost and Found', 'buddypress' ); ?>"><?php _e( 'Lost your password?', 'buddypress' ); ?></a>
    99
    1010        <?php endif; ?>
    1111
    1212        <label for="email"><?php _e( 'Account Email', 'buddypress' ); ?></label>
    13         <input type="email" name="email" id="email" value="<?php echo bp_get_displayed_user_email(); ?>" class="settings-input" />
     13        <input type="email" name="email" id="email" value="<?php echo bp_get_displayed_user_email(); ?>" class="settings-input" <?php bp_form_field_extra_attributes( 'email' ); ?>/>
    1414
    1515        <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ); ?></label>
    16         <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small password-entry" /> &nbsp;<?php _e( 'New Password', 'buddypress' ); ?><br />
     16        <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small password-entry" <?php bp_form_field_attributes( 'password' ); ?>/> &nbsp;<?php _e( 'New Password', 'buddypress' ); ?><br />
    1717        <div id="pass-strength-result"></div>
    18         <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small password-entry-confirm" /> &nbsp;<?php _e( 'Repeat New Password', 'buddypress' ); ?>
     18        <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small password-entry-confirm" <?php bp_form_field_extra_attributes( 'password' ); ?>/> &nbsp;<?php _e( 'Repeat New Password', 'buddypress' ); ?>
    1919
    2020        <?php do_action( 'bp_core_general_settings_before_submit' ); ?>
    2121