Ticket #7642: 7642-3.patch
File 7642-3.patch, 3.8 KB (added by , 7 years ago) |
---|
-
src/bp-templates/bp-nouveau/includes/template-tags.php
739 739 } 740 740 741 741 } elseif ( ! empty( $bp_nouveau->object_nav ) ) { 742 742 743 $bp_nouveau->displayed_nav = $bp_nouveau->object_nav; 743 744 744 745 /** … … 751 752 * @param array $n The arguments of the Navigation loop. 752 753 */ 753 754 $nav = apply_filters( 'bp_nouveau_get_nav', $nav, $n ); 755 754 756 } 755 757 756 758 $bp_nouveau->sorted_nav = array_values( $nav ); … … 2074 2076 } 2075 2077 2076 2078 foreach ( $fields as $name => $attributes ) { 2079 2080 // We need to ensure that $classes array is emptied before we start a new iteration of this loop. 2081 $classes = ''; 2082 2077 2083 list( $label, $required, $value, $attribute_type, $type, $class ) = array_values( $attributes ); 2078 2084 2079 2085 if ( $required ) { … … 2132 2138 $attribute_type = ' ' . checked( $value, $submitted, false ); 2133 2139 } 2134 2140 2135 if ( ! empty( $class ) ) { 2136 // In case people are adding classes.. 2137 $classes = explode( ' ', $class ); 2138 $class = ' class="' . esc_attr( join( ' ', array_map( 'sanitize_html_class', $classes ) ) ) . '"'; 2139 } 2141 // Do not run function to display errors for the private radio. 2142 if ( 'private' !== $value ) { 2140 2143 2141 // Do not fire the do_action to display errors for the private radio.2142 if ( 'private' !== $value ) {2143 2144 /** 2144 * F ires and displays anymember registration field errors.2145 * Fetch & display any BP member registration field errors. 2145 2146 * 2146 * @since 1.1.0 (BuddyPress) 2147 * Passes BP signup errors to Nouveau's template function to 2148 * render suitable markup for error string. 2147 2149 */ 2148 do_action( "bp_{$name}_errors" ); 2150 if( isset( buddypress()->signup->errors[ $name ] ) ) { 2151 nouveau_error_template( buddypress()->signup->errors[ $name ] ); 2152 2153 // If we have BP errors lets set a class for the input to style as an error. 2154 $invalid = 'invalid'; 2155 } 2149 2156 } 2150 2157 2158 if ( isset( $invalid ) && isset( buddypress()->signup->errors[ $name ] ) ) { 2159 if ( ! empty( $class ) ) { 2160 $class = $class . ' ' . $invalid; 2161 } else { 2162 $class = $invalid; 2163 } 2164 } 2165 2166 if ( ! empty( $class ) ) { 2167 2168 // In case people are adding classes &/or we have an error class to add. 2169 $classes = explode( ' ', $class ); 2170 } 2171 2172 if ( ! empty( $classes ) ) { 2173 2174 $class = ' class="' . esc_attr( join( ' ', array_map( 'sanitize_html_class', $classes ) ) ) . '"'; 2175 } 2176 2151 2177 // Set the input. 2152 2178 $field_output = sprintf( '<input type="%1$s" name="%2$s" id="%3$s" %4$s value="%5$s" %6$s />', 2153 2179 esc_attr( $type ), … … 2231 2257 do_action( $submit_data['after'] ); 2232 2258 } 2233 2259 } 2260 2261 /** 2262 * Display supplemental error or feedback messages 2263 * 2264 * This template handles in page error or feedback messages e.g signup fields 2265 * 'Username exists' type registration field error notices. 2266 * 2267 * @param string $string required: the message to display. 2268 * @param string $type optional: the type of error message e.g 'error'. 2269 * 2270 * @todo Could this requirement to handle additional messages be better served by 2271 * passing strings into the main Nouveau feedback messages array to be rendered 2272 * by the main template include for notices. 2273 * 2274 * @since 1.0.0 2275 */ 2276 function nouveau_error_template( $string = '', $type = '' ) { 2277 2278 if ( ! $string ) { 2279 return; 2280 } 2281 2282 // Set a default type & add white space if passing in a param. 2283 if ( $type ) { 2284 $type = ' ' . $type; 2285 } else { 2286 $type = ' error'; 2287 } 2288 2289 ?> 2290 2291 <div class="<?php echo esc_attr( 'bp-messages bp-feedback' . $type ); ?>"> 2292 <span class="bp-icon" aria-hidden="true"></span> 2293 <p><?php echo esc_html( $string ); ?></p> 2294 </div> 2295 2296 <?php 2297 return; 2298 }