Ticket #7642: 7642-2.patch
File 7642-2.patch, 3.2 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 ); … … 2132 2134 $attribute_type = ' ' . checked( $value, $submitted, false ); 2133 2135 } 2134 2136 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 } 2137 // Do not run function to display errors for the private radio. 2138 if ( 'private' !== $value ) { 2140 2139 2141 // Do not fire the do_action to display errors for the private radio.2142 if ( 'private' !== $value ) {2143 2140 /** 2144 * F ires and displays anymember registration field errors.2141 * Fetch & display any BP member registration field errors. 2145 2142 * 2146 * @since 1.1.0 (BuddyPress) 2143 * Passes BP signup errors to Nouveau's template function to 2144 * render suitable markup for error string. 2147 2145 */ 2148 do_action( "bp_{$name}_errors" ); 2146 if( isset( buddypress()->signup->errors[$name] ) ) { 2147 nouveau_error_template( buddypress()->signup->errors[$name], 'error' ); 2148 2149 // If we have BP errors lets set a class for the input to style as an error. 2150 $class .= ' invalid'; 2151 } 2149 2152 } 2150 2153 2154 if ( ! empty( $class ) ) { 2155 2156 // In case people are adding classes 2157 // &/or we have an error class to add. 2158 $classes = explode( ' ', $class ); 2159 } 2160 2161 if ( isset( $classes ) ) { 2162 2163 // If we only have one token then lets trim the empty space 2164 $str_spacer = ( count( $classes ) > 2 )? ' ' : ''; 2165 2166 $class = ' class="' . esc_attr( join( $str_spacer, array_map( 'sanitize_html_class', $classes ) ) ) . '"'; 2167 } 2168 2151 2169 // Set the input. 2152 2170 $field_output = sprintf( '<input type="%1$s" name="%2$s" id="%3$s" %4$s value="%5$s" %6$s />', 2153 2171 esc_attr( $type ), … … 2231 2249 do_action( $submit_data['after'] ); 2232 2250 } 2233 2251 } 2252 2253 /** 2254 * Display supplemental error or feedback messages 2255 * 2256 * This template handles in page error or feedback messages e.g signup fields 2257 * 'Username exists' type registration fields error notice. 2258 * 2259 * @param string $string required: the message to display. 2260 * @param string $type optional: the type of error message e.g 'error'. 2261 * 2262 * @todo Could this requirement to handle additional messages be better served by 2263 * passing strings into the main Nouveau feedback messages array to be rendered 2264 * by the main template include for notices. 2265 * 2266 * @since 1.0.0 2267 */ 2268 function nouveau_error_template( $string = '', $type = '' ) { 2269 2270 if ( ! $string ) 2271 return; 2272 ?> 2273 2274 <div class="bp-messages bp-feedback <?php echo esc_attr( $type ); ?>"> 2275 <span class="bp-icon" aria-hidden="true"></span> 2276 <p><?php echo esc_html( $string ); ?></p> 2277 </div> 2278 2279 <?php 2280 return; 2281 }