Skip to:
Content

BuddyPress.org

Ticket #6997: 6997-bp-blogs-template.patch

File 6997-bp-blogs-template.patch, 10.0 KB (added by Offereins, 8 years ago)

Filter updates for bp-blogs-template.php

  • src/bp-blogs/bp-blogs-template.php

    diff --git a/src/bp-blogs/bp-blogs-template.php b/src/bp-blogs/bp-blogs-template.php
    index e31a1ac..1d676a7 100644
    a b function bp_blog_latest_post( $args = array() ) { 
    631631                 * Filters the HTML markup result for the latest blog post in loop.
    632632                 *
    633633                 * @since 1.2.0
     634                 * @since 2.6.0 Added the `$r` parameter.
    634635                 *
    635636                 * @param string $retval HTML markup for the latest post.
     637                 * @param array  $r      Array of parsed arguments.
    636638                 */
    637                 return apply_filters( 'bp_get_blog_latest_post', $retval );
     639                return apply_filters( 'bp_get_blog_latest_post', $retval, $r );
    638640        }
    639641
    640642/**
    function bp_total_blog_count_for_user( $user_id = 0 ) { 
    876878                 * Filters the total number of blogs for a given user.
    877879                 *
    878880                 * @since 1.2.0
     881                 * @since 2.6.0 Added the `$user_id` parameter.
    879882                 *
    880                  * @param int $value Total number of blogs for a given user.
     883                 * @param int $value   Total number of blogs for a given user.
     884                 * @param int $user_id ID of the queried user.
    881885                 */
    882                 return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ) );
     886                return apply_filters( 'bp_get_total_blog_count_for_user', bp_blogs_total_blogs_for_user( $user_id ), $user_id );
    883887        }
    884888        add_filter( 'bp_get_total_blog_count_for_user', 'bp_core_number_format' );
    885889
    function bp_blog_signup_enabled() { 
    926930 * @param string|WP_Error $errors     Optional. The WP_Error object returned by a previous
    927931 *                                    submission attempt.
    928932 */
    929 function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = '') {
     933function bp_show_blog_signup_form( $blogname = '', $blog_title = '', $errors = '' ) {
    930934        global $current_user;
    931935
    932936        if ( isset($_POST['submit']) ) {
    function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = '' 
    947951                 *      WP_Error $errors     WP_Error object.
    948952                 * }
    949953                 */
    950                 $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ));
     954                $filtered_results = apply_filters( 'signup_another_blog_init', array( 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors ) );
    951955                $blogname = $filtered_results['blogname'];
    952956                $blog_title = $filtered_results['blog_title'];
    953957                $errors = $filtered_results['errors'];
    954958
    955959                if ( $errors->get_error_code() ) {
    956                         echo "<p>" . __('There was a problem; please correct the form below and try again.', 'buddypress') . "</p>";
     960                        echo "<p>" . __( 'There was a problem; please correct the form below and try again.', 'buddypress' ) . "</p>";
    957961                }
    958962                ?>
    959                 <p><?php printf(__("By filling out the form below, you can <strong>add a site to your account</strong>. There is no limit to the number of sites that you can have, so create to your heart's content, but blog responsibly!", 'buddypress'), $current_user->display_name) ?></p>
     963                <p><?php printf( __( "By filling out the form below, you can <strong>add a site to your account</strong>. There is no limit to the number of sites that you can have, so create to your heart's content, but blog responsibly!", 'buddypress' ), $current_user->display_name ); ?></p>
    960964
    961                 <p><?php _e("If you&#8217;re not going to use a great domain, leave it for a new user. Now have at it!", 'buddypress') ?></p>
     965                <p><?php _e( "If you&#8217;re not going to use a great domain, leave it for a new user. Now have at it!", 'buddypress' ); ?></p>
    962966
    963967                <form class="standard-form" id="setupform" method="post" action="">
    964968
    function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = '' 
    972976                         */
    973977                        do_action( 'signup_hidden_fields' ); ?>
    974978
    975                         <?php bp_blogs_signup_blog($blogname, $blog_title, $errors); ?>
     979                        <?php bp_blogs_signup_blog( $blogname, $blog_title, $errors ); ?>
    976980                        <p>
    977                                 <input id="submit" type="submit" name="submit" class="submit" value="<?php esc_attr_e('Create Site', 'buddypress') ?>" />
     981                                <input id="submit" type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site', 'buddypress' ); ?>" />
    978982                        </p>
    979983
    980                         <?php wp_nonce_field( 'bp_blog_signup_form' ) ?>
     984                        <?php wp_nonce_field( 'bp_blog_signup_form' ); ?>
    981985                </form>
    982986                <?php
    983987        }
    function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' ) 
    995999        global $current_site;
    9961000
    9971001        // Blog name.
    998         if( !is_subdomain_install() )
    999                 echo '<label for="blogname">' . __('Site Name:', 'buddypress') . '</label>';
     1002        if ( ! is_subdomain_install() )
     1003                echo '<label for="blogname">' . __( 'Site Name:', 'buddypress' ) . '</label>';
    10001004        else
    1001                 echo '<label for="blogname">' . __('Site Domain:', 'buddypress') . '</label>';
     1005                echo '<label for="blogname">' . __( 'Site Domain:', 'buddypress' ) . '</label>';
    10021006
    1003         if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
     1007        if ( $errmsg = $errors->get_error_message( 'blogname') ) { ?>
    10041008
    10051009                <p class="error"><?php echo $errmsg ?></p>
    10061010
    10071011        <?php }
    10081012
    1009         if ( !is_subdomain_install() )
     1013        if ( ! is_subdomain_install() )
    10101014                echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span> <input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63" /><br />';
    10111015        else
    10121016                echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63" ' . bp_get_form_field_attributes( 'blogname' ) . '/> <span class="suffix_address">.' . bp_blogs_get_subdomain_base() . '</span><br />';
    10131017
    1014         if ( !is_user_logged_in() ) {
    1015                 print '(<strong>' . __( 'Your address will be ' , 'buddypress');
     1018        if ( ! is_user_logged_in() ) {
     1019                print '(<strong>' . __( 'Your address will be ' , 'buddypress' );
    10161020
    1017                 if ( !is_subdomain_install() ) {
    1018                         print $current_site->domain . $current_site->path . __( 'blogname' , 'buddypress');
     1021                if ( ! is_subdomain_install() ) {
     1022                        print $current_site->domain . $current_site->path . __( 'blogname' , 'buddypress' );
    10191023                } else {
    1020                         print __( 'domain.' , 'buddypress') . $current_site->domain . $current_site->path;
     1024                        print __( 'domain.' , 'buddypress' ) . $current_site->domain . $current_site->path;
    10211025                }
    10221026
    1023                 echo '.</strong> ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' , 'buddypress') . '</p>';
     1027                echo '.</strong> ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' , 'buddypress' ) . '</p>';
    10241028        }
    10251029
    10261030        // Blog Title.
    10271031        ?>
    10281032
    1029         <label for="blog_title"><?php _e('Site Title:', 'buddypress') ?></label>
     1033        <label for="blog_title"><?php _e( 'Site Title:', 'buddypress' ); ?></label>
    10301034
    1031         <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
     1035        <?php if ( $errmsg = $errors->get_error_message( 'blog_title' ) ) { ?>
    10321036
    1033                 <p class="error"><?php echo $errmsg ?></p>
     1037                <p class="error"><?php echo $errmsg; ?></p>
    10341038
    10351039        <?php }
    1036         echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_html($blog_title, 1).'" /></p>';
     1040        echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_html( $blog_title, 1 ) . '" /></p>';
    10371041        ?>
    10381042
    10391043        <p>
    1040                 <label for="blog_public_on"><?php _e('Privacy:', 'buddypress') ?></label>
     1044                <label for="blog_public_on"><?php _e( 'Privacy:', 'buddypress' ); ?></label>
    10411045                <?php _e( 'I would like my site to appear in search engines, and in public listings around this network.', 'buddypress' ); ?>
    10421046
    10431047                <label class="checkbox" for="blog_public_on">
    1044                         <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if( !isset( $_POST['blog_public'] ) || '1' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
    1045                         <strong><?php _e( 'Yes' , 'buddypress'); ?></strong>
     1048                        <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || '1' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
     1049                        <strong><?php _e( 'Yes' , 'buddypress' ); ?></strong>
    10461050                </label>
    10471051                <label class="checkbox" for="blog_public_off">
    1048                         <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
    1049                         <strong><?php _e( 'No' , 'buddypress'); ?></strong>
     1052                        <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) { ?>checked="checked"<?php } ?> />
     1053                        <strong><?php _e( 'No' , 'buddypress' ); ?></strong>
    10501054                </label>
    10511055        </p>
    10521056
    function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' ) 
    10591063         *
    10601064         * @param WP_Error $errors WP_Error object if any present.
    10611065         */
    1062         do_action('signup_blogform', $errors);
     1066        do_action( 'signup_blogform', $errors );
    10631067}
    10641068
    10651069/**
    function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' ) 
    10721076function bp_blogs_validate_blog_signup() {
    10731077        global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path, $current_site;
    10741078
    1075         if ( !check_admin_referer( 'bp_blog_signup_form' ) )
     1079        if ( ! check_admin_referer( 'bp_blog_signup_form' ) )
    10761080                return false;
    10771081
    10781082        $current_user = wp_get_current_user();
    10791083
    1080         if( !is_user_logged_in() )
     1084        if ( ! is_user_logged_in() )
    10811085                die();
    10821086
    10831087        $result = bp_blogs_validate_blog_form();
    function bp_blogs_validate_blog_form() { 
    11271131        if ( is_user_logged_in() )
    11281132                $user = wp_get_current_user();
    11291133
    1130         return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
     1134        return wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'], $user );
    11311135}
    11321136
    11331137/**
    function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, 
    11501154        restore_current_blog();
    11511155
    11521156        ?>
    1153         <p><?php _e( 'Congratulations! You have successfully registered a new site.', 'buddypress' ) ?></p>
     1157        <p><?php _e( 'Congratulations! You have successfully registered a new site.', 'buddypress' ); ?></p>
    11541158        <p>
    11551159                <?php printf(
    11561160                        '%s %s',
    function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, 
    11741178         *
    11751179         * @since 1.0.0
    11761180         */
    1177         do_action('signup_finished');
     1181        do_action( 'signup_finished' );
    11781182}
    11791183
    11801184/**