bp_show_blog_signup_form( string $blogname = '', string $blog_title = '', string|WP_Error $errors = '' )
Output the wrapper markup for the blog signup form.
Parameters Parameters
- $blogname
-
(string) (Optional) The default blog name (path or domain).
Default value: ''
- $blog_title
-
(string) (Optional) The default blog title.
Default value: ''
- $errors
-
(string|WP_Error) (Optional) The WP_Error object returned by a previous submission attempt.
Default value: ''
Source Source
File: bp-blogs/bp-blogs-template.php
function bp_show_blog_signup_form( $blogname = '', $blog_title = '', $errors = '' ) { $blog_id = bp_blogs_validate_blog_signup(); // Display the signup form. if ( false === $blog_id || is_wp_error( $blog_id ) ) { if ( is_wp_error( $blog_id ) ) { $errors = $blog_id; } else { $errors = new WP_Error(); } /** * Filters the default values for Blog name, title, and any current errors. * * @since 1.0.0 * * @param array $value { * string $blogname Default blog name provided. * string $blog_title Default blog title provided. * WP_Error $errors WP_Error object. * } */ $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); $blogname = $filtered_results['blogname']; $blog_title = $filtered_results['blog_title']; $errors = $filtered_results['errors']; if ( $errors->get_error_code() ) { if ( in_array( $errors->get_error_code(), array( 'blogname', 'blog_title' ), true ) ) { printf( '<p class="error">%s</p>', esc_html__( 'There was a problem; please correct the form below and try again.', 'buddypress' ) ); } else { printf( '<p class="error">%s</p>', $errors->get_error_message() ); } } printf( '<p>%1$s <strong>%2$s</strong>. %3$s</p>', esc_html__( 'By filling out the form below, you can', 'buddypress' ), esc_html__( 'add a site to your account', 'buddypress' ), esc_html__( 'There is no limit to the number of sites that you can have, so create to your heart’s content, but blog responsibly!', 'buddypress' ) ); ?> <p> <?php esc_html_e( 'If you’re not going to use a great domain, leave it for a new user. Now have at it!', 'buddypress' ); ?> </p> <form class="standard-form" id="setupform" method="post" action=""> <input type="hidden" name="stage" value="gimmeanotherblog" /> <?php /** * Fires after the default hidden fields in blog signup form markup. * * @since 1.0.0 */ do_action( 'signup_hidden_fields' ); ?> <?php bp_blogs_signup_blog( $blogname, $blog_title, $errors ); ?> <p> <input id="submit" type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site', 'buddypress' ); ?>" /> </p> <?php wp_nonce_field( 'bp_blog_signup_form' ) ?> </form> <?php // Display the confirmation form. } elseif ( is_numeric( $blog_id ) ) { // Validate the site. $site = get_site( $blog_id ); if ( isset( $site->id ) && $site->id ) { $current_user = wp_get_current_user(); bp_blogs_confirm_blog_signup( $site->domain, $site->path, $site->blogname, $current_user->user_login, $current_user->user_email, '', $site->id ); } } }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |