Ticket #5914: 5914.bp_signup_field_attributes.patch
File 5914.bp_signup_field_attributes.patch, 4.1 KB (added by , 10 years ago) |
---|
-
src/bp-members/bp-members-template.php
1931 1931 } 1932 1932 1933 1933 /** 1934 * Output the field attributes for a signup field on the registration page. 1935 * 1936 * @since BuddyPress (2.2.0) 1937 * 1938 * @param string $type The field type to output attributes for. 1939 */ 1940 function bp_signup_field_attributes( $type = '' ) { 1941 echo bp_get_signup_field_attributes( $type ); 1942 } 1943 /** 1944 * Get the field attributes for a signup field on the registration page. 1945 * 1946 * @since BuddyPress (2.2.0) 1947 * 1948 * @param string $type The field type to get attributes for. 1949 */ 1950 function bp_get_signup_field_attributes( $type = '' ) { 1951 $retval = ''; 1952 $attributes = array(); 1953 1954 switch ( $type ) { 1955 case 'username' : 1956 $attributes['autocomplete'] = 'off'; 1957 break; 1958 1959 case 'email' : 1960 if ( wp_is_mobile() ) { 1961 $attributes['autocapitalize'] = 'off'; 1962 } 1963 break; 1964 1965 case 'password' : 1966 $attributes['spellcheck'] = 'false'; 1967 $attributes['autocomplete'] = 'off'; 1968 1969 if ( wp_is_mobile() ) { 1970 $attributes['autocorrect'] = 'false'; 1971 $attributes['autocapitalize'] = 'off'; 1972 } 1973 break; 1974 } 1975 1976 /** 1977 * Filter the field attributes for a signup field before rendering output. 1978 * 1979 * @since BuddyPress (2.2.0) 1980 * 1981 * @param array $attributes The field attributes 1982 * @param string $type The field type 1983 */ 1984 $attributes = apply_filters( 'bp_get_signup_field_attributes', $attributes, $type ); 1985 1986 foreach( (array) $attributes as $attr => $value ) { 1987 $attr = sanitize_title( $attr ); 1988 $value = esc_attr( $value ); 1989 $retval .= " {$attr}=\"{$value}\""; 1990 } 1991 1992 echo $retval; 1993 } 1994 1995 /** 1934 1996 * Output the 'signup_with_blog' value submitted during signup. 1935 1997 */ 1936 1998 function bp_signup_with_blog_value() { -
src/bp-templates/bp-legacy/buddypress/members/register.php
31 31 32 32 <label for="signup_username"><?php _e( 'Username', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label> 33 33 <?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_signup_field_attributes( 'username' ); ?>/> 35 35 36 36 <label for="signup_email"><?php _e( 'Email Address', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label> 37 37 <?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_signup_field_attributes( 'email' ); ?>/> 39 39 40 40 <label for="signup_password"><?php _e( 'Choose a Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label> 41 41 <?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_signup_field_attributes( 'password' ); ?>/> 43 43 <div id="pass-strength-result"></div> 44 44 45 45 <label for="signup_password_confirm"><?php _e( 'Confirm Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label> 46 46 <?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_signup_field_attributes( 'password' ); ?>/> 48 48 49 49 <?php do_action( 'bp_account_details_fields' ); ?> 50 50