Skip to:
Content

BuddyPress.org

Changeset 10682


Ignore:
Timestamp:
03/23/2016 03:30:10 PM (6 years ago)
Author:
boonebgorges
Message:

Improve the way blog signup confirmation strings are built.

  • Remove markup from the strings, where possible.
  • Use core functions to generate URLs, rather than manually concatenating.
  • Pass $blog_id to bp_blogs_confirm_blog_signup().

Props ramiy, boonebgorges.
Fixes #6909.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-template.php

    r10652 r10682  
    11111111        $domain = $blogname . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
    11121112
    1113     wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
    1114     bp_blogs_confirm_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
     1113    $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
     1114    bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
    11151115    return true;
    11161116}
     
    11331133/**
    11341134 * Display a message after successful blog registration.
     1135 *
     1136 * @since 2.6.0 Introduced `$blog_id` parameter.
    11351137 *
    11361138 * @param string       $domain     The new blog's domain.
     
    11401142 * @param string       $user_email The email of the user who created the blog. Unused.
    11411143 * @param string|array $meta       Meta values associated with the new blog. Unused.
    1142  */
    1143 function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = '' ) {
    1144     $protocol = is_ssl() ? 'https://' : 'http://';
    1145     $blog_url = $protocol . $domain . $path; ?>
    1146 
     1144 * @param int          $blog_id    ID of the newly created blog.
     1145 */
     1146function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = '', $blog_id = null ) {
     1147    switch_to_blog( $blog_id );
     1148    $blog_url  = set_url_scheme( home_url() );
     1149    $login_url = set_url_scheme( wp_login_url() );
     1150    restore_current_blog();
     1151
     1152    ?>
    11471153    <p><?php _e( 'Congratulations! You have successfully registered a new site.', 'buddypress' ) ?></p>
    11481154    <p>
    1149         <?php printf(__( '<a href="%1$s">%2$s</a> is your new site.  <a href="%3$s">Login</a> as "%4$s" using your existing password.', 'buddypress' ), $blog_url, $blog_url, $blog_url . "wp-login.php", $user_name ); ?>
     1155        <?php printf(
     1156            '%s %s',
     1157            sprintf(
     1158                __( '%s is your new site.', 'buddypress' ),
     1159                sprintf( '<a href="%s">%s</a>', esc_url( $blog_url ), esc_url( $blog_url ) )
     1160            ),
     1161            sprintf(
     1162                /* translators: 1: Login URL, 2: User name */
     1163                __( '<a href="%1$s">Log in</a> as "%2$s" using your existing password.', 'buddypress' ),
     1164                esc_url( $login_url ),
     1165                esc_html( $user_name )
     1166            )
     1167        ); ?>
    11501168    </p>
    11511169
Note: See TracChangeset for help on using the changeset viewer.