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() ) { |
631 | 631 | * Filters the HTML markup result for the latest blog post in loop. |
632 | 632 | * |
633 | 633 | * @since 1.2.0 |
| 634 | * @since 2.6.0 Added the `$r` parameter. |
634 | 635 | * |
635 | 636 | * @param string $retval HTML markup for the latest post. |
| 637 | * @param array $r Array of parsed arguments. |
636 | 638 | */ |
637 | | return apply_filters( 'bp_get_blog_latest_post', $retval ); |
| 639 | return apply_filters( 'bp_get_blog_latest_post', $retval, $r ); |
638 | 640 | } |
639 | 641 | |
640 | 642 | /** |
… |
… |
function bp_total_blog_count_for_user( $user_id = 0 ) { |
876 | 878 | * Filters the total number of blogs for a given user. |
877 | 879 | * |
878 | 880 | * @since 1.2.0 |
| 881 | * @since 2.6.0 Added the `$user_id` parameter. |
879 | 882 | * |
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. |
881 | 885 | */ |
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 ); |
883 | 887 | } |
884 | 888 | add_filter( 'bp_get_total_blog_count_for_user', 'bp_core_number_format' ); |
885 | 889 | |
… |
… |
function bp_blog_signup_enabled() { |
926 | 930 | * @param string|WP_Error $errors Optional. The WP_Error object returned by a previous |
927 | 931 | * submission attempt. |
928 | 932 | */ |
929 | | function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = '') { |
| 933 | function bp_show_blog_signup_form( $blogname = '', $blog_title = '', $errors = '' ) { |
930 | 934 | global $current_user; |
931 | 935 | |
932 | 936 | if ( isset($_POST['submit']) ) { |
… |
… |
function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = '' |
947 | 951 | * WP_Error $errors WP_Error object. |
948 | 952 | * } |
949 | 953 | */ |
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 ) ); |
951 | 955 | $blogname = $filtered_results['blogname']; |
952 | 956 | $blog_title = $filtered_results['blog_title']; |
953 | 957 | $errors = $filtered_results['errors']; |
954 | 958 | |
955 | 959 | 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>"; |
957 | 961 | } |
958 | 962 | ?> |
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> |
960 | 964 | |
961 | | <p><?php _e("If you’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’re not going to use a great domain, leave it for a new user. Now have at it!", 'buddypress' ); ?></p> |
962 | 966 | |
963 | 967 | <form class="standard-form" id="setupform" method="post" action=""> |
964 | 968 | |
… |
… |
function bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = '' |
972 | 976 | */ |
973 | 977 | do_action( 'signup_hidden_fields' ); ?> |
974 | 978 | |
975 | | <?php bp_blogs_signup_blog($blogname, $blog_title, $errors); ?> |
| 979 | <?php bp_blogs_signup_blog( $blogname, $blog_title, $errors ); ?> |
976 | 980 | <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' ); ?>" /> |
978 | 982 | </p> |
979 | 983 | |
980 | | <?php wp_nonce_field( 'bp_blog_signup_form' ) ?> |
| 984 | <?php wp_nonce_field( 'bp_blog_signup_form' ); ?> |
981 | 985 | </form> |
982 | 986 | <?php |
983 | 987 | } |
… |
… |
function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' ) |
995 | 999 | global $current_site; |
996 | 1000 | |
997 | 1001 | // 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>'; |
1000 | 1004 | else |
1001 | | echo '<label for="blogname">' . __('Site Domain:', 'buddypress') . '</label>'; |
| 1005 | echo '<label for="blogname">' . __( 'Site Domain:', 'buddypress' ) . '</label>'; |
1002 | 1006 | |
1003 | | if ( $errmsg = $errors->get_error_message('blogname') ) { ?> |
| 1007 | if ( $errmsg = $errors->get_error_message( 'blogname') ) { ?> |
1004 | 1008 | |
1005 | 1009 | <p class="error"><?php echo $errmsg ?></p> |
1006 | 1010 | |
1007 | 1011 | <?php } |
1008 | 1012 | |
1009 | | if ( !is_subdomain_install() ) |
| 1013 | if ( ! is_subdomain_install() ) |
1010 | 1014 | echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span> <input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="63" /><br />'; |
1011 | 1015 | else |
1012 | 1016 | 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 />'; |
1013 | 1017 | |
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' ); |
1016 | 1020 | |
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' ); |
1019 | 1023 | } else { |
1020 | | print __( 'domain.' , 'buddypress') . $current_site->domain . $current_site->path; |
| 1024 | print __( 'domain.' , 'buddypress' ) . $current_site->domain . $current_site->path; |
1021 | 1025 | } |
1022 | 1026 | |
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>'; |
1024 | 1028 | } |
1025 | 1029 | |
1026 | 1030 | // Blog Title. |
1027 | 1031 | ?> |
1028 | 1032 | |
1029 | | <label for="blog_title"><?php _e('Site Title:', 'buddypress') ?></label> |
| 1033 | <label for="blog_title"><?php _e( 'Site Title:', 'buddypress' ); ?></label> |
1030 | 1034 | |
1031 | | <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?> |
| 1035 | <?php if ( $errmsg = $errors->get_error_message( 'blog_title' ) ) { ?> |
1032 | 1036 | |
1033 | | <p class="error"><?php echo $errmsg ?></p> |
| 1037 | <p class="error"><?php echo $errmsg; ?></p> |
1034 | 1038 | |
1035 | 1039 | <?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>'; |
1037 | 1041 | ?> |
1038 | 1042 | |
1039 | 1043 | <p> |
1040 | | <label for="blog_public_on"><?php _e('Privacy:', 'buddypress') ?></label> |
| 1044 | <label for="blog_public_on"><?php _e( 'Privacy:', 'buddypress' ); ?></label> |
1041 | 1045 | <?php _e( 'I would like my site to appear in search engines, and in public listings around this network.', 'buddypress' ); ?> |
1042 | 1046 | |
1043 | 1047 | <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> |
1046 | 1050 | </label> |
1047 | 1051 | <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> |
1050 | 1054 | </label> |
1051 | 1055 | </p> |
1052 | 1056 | |
… |
… |
function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' ) |
1059 | 1063 | * |
1060 | 1064 | * @param WP_Error $errors WP_Error object if any present. |
1061 | 1065 | */ |
1062 | | do_action('signup_blogform', $errors); |
| 1066 | do_action( 'signup_blogform', $errors ); |
1063 | 1067 | } |
1064 | 1068 | |
1065 | 1069 | /** |
… |
… |
function bp_blogs_signup_blog( $blogname = '', $blog_title = '', $errors = '' ) |
1072 | 1076 | function bp_blogs_validate_blog_signup() { |
1073 | 1077 | global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path, $current_site; |
1074 | 1078 | |
1075 | | if ( !check_admin_referer( 'bp_blog_signup_form' ) ) |
| 1079 | if ( ! check_admin_referer( 'bp_blog_signup_form' ) ) |
1076 | 1080 | return false; |
1077 | 1081 | |
1078 | 1082 | $current_user = wp_get_current_user(); |
1079 | 1083 | |
1080 | | if( !is_user_logged_in() ) |
| 1084 | if ( ! is_user_logged_in() ) |
1081 | 1085 | die(); |
1082 | 1086 | |
1083 | 1087 | $result = bp_blogs_validate_blog_form(); |
… |
… |
function bp_blogs_validate_blog_form() { |
1127 | 1131 | if ( is_user_logged_in() ) |
1128 | 1132 | $user = wp_get_current_user(); |
1129 | 1133 | |
1130 | | return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user); |
| 1134 | return wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'], $user ); |
1131 | 1135 | } |
1132 | 1136 | |
1133 | 1137 | /** |
… |
… |
function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, |
1150 | 1154 | restore_current_blog(); |
1151 | 1155 | |
1152 | 1156 | ?> |
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> |
1154 | 1158 | <p> |
1155 | 1159 | <?php printf( |
1156 | 1160 | '%s %s', |
… |
… |
function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, |
1174 | 1178 | * |
1175 | 1179 | * @since 1.0.0 |
1176 | 1180 | */ |
1177 | | do_action('signup_finished'); |
| 1181 | do_action( 'signup_finished' ); |
1178 | 1182 | } |
1179 | 1183 | |
1180 | 1184 | /** |