bp_nouveau_signup_form( string $section = 'account_details' )
Output the signup form for the requested section
Description
Parameters
- $section
-
(Optional) The section of fields to get 'account_details' or 'blog_details'. Default: 'account_details'.
Default value: 'account_details'
Source
File: bp-templates/bp-nouveau/includes/template-tags.php
function bp_nouveau_signup_form( $section = 'account_details' ) { $fields = bp_nouveau_get_signup_fields( $section ); if ( ! $fields ) { return; } foreach ( $fields as $name => $attributes ) { list( $label, $required, $value, $attribute_type, $type, $class ) = array_values( $attributes ); // Text fields are using strings, radios are using their inputs $label_output = '<label for="%1$s">%2$s</label>'; $id = $name; $classes = ''; if ( $required ) { /* translators: Do not translate placeholders. 2 = form field name, 3 = "(required)". */ $label_output = __( '<label for="%1$s">%2$s %3$s</label>', 'buddyboss' ); } // Output the label for regular fields if ( 'radio' !== $type ) { if ( $required ) { printf( $label_output, esc_attr( $name ), esc_html( $label ), '' ); } else { printf( $label_output, esc_attr( $name ), esc_html( $label ) ); } if ( ! empty( $value ) && is_callable( $value ) ) { $value = call_user_func( $value ); } // Handle the specific case of Site's privacy differently } elseif ( 'signup_blog_privacy_private' !== $name ) { ?> <span class="label"> <?php esc_html_e( 'I would like my site to appear in search engines, and in public listings around this network.', 'buddyboss' ); ?> </span> <?php } // Set the additional attributes if ( $attribute_type ) { $existing_attributes = array(); if ( ! empty( $required ) ) { $existing_attributes = array( 'aria-required' => 'true' ); /** * The blog section is hidden, so let's avoid a browser warning * and deal with the Blog section in Javascript. */ if ( $section !== 'blog_details' ) { // Removed because we don't have to display the browser error message. //$existing_attributes['required'] = 'required'; } } $attribute_type = ' ' . bp_get_form_field_attributes( $attribute_type, $existing_attributes ); } // Specific case for Site's privacy if ( 'signup_blog_privacy_public' === $name || 'signup_blog_privacy_private' === $name ) { $name = 'signup_blog_privacy'; $submitted = bp_get_signup_blog_privacy_value(); if ( ! $submitted ) { $submitted = 'public'; } $attribute_type = ' ' . checked( $value, $submitted, false ); } // Do not run function to display errors for the private radio. if ( 'private' !== $value ) { /** * Fetch & display any BP member registration field errors. * * Passes BP signup errors to Nouveau's template function to * render suitable markup for error string. */ if ( isset( buddypress()->signup->errors[ $name ] ) ) { nouveau_error_template( buddypress()->signup->errors[ $name ] ); $invalid = 'invalid'; } } if ( isset( $invalid ) && isset( buddypress()->signup->errors[ $name ] ) ) { if ( ! empty( $class ) ) { $class = $class . ' ' . $invalid; } else { $class = $invalid; } } if ( $class ) { $class = sprintf( ' class="%s"', esc_attr( join( ' ', array_map( 'sanitize_html_class', explode( ' ', $class ) ) ) ) ); } // Set the input. $field_output = sprintf( '<input type="%1$s" name="%2$s" id="%3$s" %4$s value="%5$s" %6$s />', esc_attr( $type ), esc_attr( $name ), esc_attr( $id ), $class, // Constructed safely above. esc_attr( $value ), $attribute_type // Constructed safely above. ); // Not a radio, let's output the field if ( 'radio' !== $type ) { if ( 'signup_blog_url' !== $name ) { print( $field_output ); // Constructed safely above. // If it's the signup blog url, it's specific to Multisite config. } elseif ( is_subdomain_install() ) { // Constructed safely above. printf( '%1$s %2$s . %3$s', is_ssl() ? 'https://' : 'http://', $field_output, bp_signup_get_subdomain_base() ); // Subfolders! } else { printf( '%1$s %2$s', home_url( '/' ), $field_output // Constructed safely above. ); } // It's a radio, let's output the field inside the label } else { // $label_output and $field_output are constructed safely above. printf( $label_output, esc_attr( $name ), $field_output . ' ' . esc_html( $label ) ); } // Password strength is restricted to the signup_password field if ( 'signup_password' === $name ) : ?> <div id="pass-strength-result"></div> <?php endif; } /** * Fires and displays any extra member registration details fields. * * This is a variable hook that depends on the current section. * * @since BuddyPress 1.9.0 */ do_action( "bp_{$section}_fields" ); }
Changelog
Version | Description |
---|---|
BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.