- Timestamp:
- 08/26/2024 11:10:35 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/classes/class-bp-blogs-theme-compat.php
r10517 r14010 38 38 39 39 // Bail if not looking at a group. 40 if ( ! bp_is_blogs_component() ) 40 if ( ! bp_is_blogs_component() ) { 41 41 return; 42 } 42 43 43 44 // Bail if looking at a users sites. 44 if ( bp_is_user() ) 45 if ( bp_is_user() ) { 45 46 return; 47 } 46 48 47 49 // Blog Directory. … … 57 59 do_action( 'bp_blogs_screen_index' ); 58 60 59 add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) );61 add_filter( 'bp_get_buddypress_template', array( $this, 'directory_template_hierarchy' ) ); 60 62 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) ); 61 add_filter( 'bp_replace_the_content', array( $this, 'directory_content') );62 63 // Create blog.63 add_filter( 'bp_replace_the_content', array( $this, 'directory_content' ) ); 64 65 // Create blog. 64 66 } elseif ( is_user_logged_in() && bp_blog_signup_enabled() ) { 65 add_filter( 'bp_get_buddypress_template', array( $this, 'create_template_hierarchy' ) );67 add_filter( 'bp_get_buddypress_template', array( $this, 'create_template_hierarchy' ) ); 66 68 add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'create_dummy_post' ) ); 67 add_filter( 'bp_replace_the_content', array( $this, 'create_content') );69 add_filter( 'bp_replace_the_content', array( $this, 'create_content' ) ); 68 70 } 69 71 } … … 79 81 * @since 1.8.0 80 82 * 81 * @param string$templates The templates from bp_get_theme_compat_templates().83 * @param array $templates The templates from bp_get_theme_compat_templates(). 82 84 * @return array $templates Array of custom templates to look for. 83 85 */ 84 86 public function directory_template_hierarchy( $templates ) { 87 88 if ( empty( $templates ) || ! is_array( $templates ) ) { 89 $templates = array(); 90 } 85 91 86 92 /** … … 89 95 * @since 1.8.0 90 96 * 91 * @param array $ valueArray of template paths to add to template list to look for.97 * @param array $template_paths Array of template paths to add to template list to look for. 92 98 */ 93 $new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array( 94 'blogs/index-directory.php' 95 ) ); 99 $new_templates = apply_filters( 100 'bp_template_hierarchy_blogs_create', 101 array( 102 'blogs/index-directory.php', 103 ) 104 ); 96 105 97 106 // Merge new templates with existing stack 98 107 // @see bp_get_theme_compat_templates(). 99 $templates = array_merge( (array) $new_templates, $templates ); 100 101 return $templates; 108 return array_merge( $new_templates, $templates ); 102 109 } 103 110 … … 108 115 */ 109 116 public function directory_dummy_post() { 110 111 bp_theme_compat_reset_post( array( 112 'ID' => 0, 113 'post_title' => __( 'Sites', 'buddypress' ), 114 'post_author' => 0, 115 'post_date' => 0, 116 'post_content' => '', 117 'post_type' => 'page', 118 'post_status' => 'publish', 119 'is_page' => true, 120 'comment_status' => 'closed' 121 ) ); 117 bp_theme_compat_reset_post( 118 array( 119 'ID' => 0, 120 'post_title' => __( 'Sites', 'buddypress' ), 121 'post_author' => 0, 122 'post_date' => 0, 123 'post_content' => '', 124 'post_type' => 'page', 125 'post_status' => 'publish', 126 'is_page' => true, 127 'comment_status' => 'closed', 128 ) 129 ); 122 130 } 123 131 … … 126 134 * 127 135 * @since 1.7.0 136 * 137 * @return string|null 128 138 */ 129 139 public function directory_content() { … … 141 151 * @since 1.8.0 142 152 * 143 * @param string$templates The templates from bp_get_theme_compat_templates().153 * @param array $templates The templates from bp_get_theme_compat_templates(). 144 154 * @return array $templates Array of custom templates to look for. 145 155 */ 146 156 public function create_template_hierarchy( $templates ) { 157 158 if ( empty( $templates ) || ! is_array( $templates ) ) { 159 $templates = array(); 160 } 147 161 148 162 /** … … 151 165 * @since 1.8.0 152 166 * 153 * @param array $ valueArray of template paths to add to template list to look for.167 * @param array $template_paths Array of template paths to add to template list to look for. 154 168 */ 155 $new_templates = apply_filters( 'bp_template_hierarchy_blogs_create', array( 156 'blogs/index-create.php' 157 ) ); 169 $new_templates = apply_filters( 170 'bp_template_hierarchy_blogs_create', 171 array( 172 'blogs/index-create.php', 173 ) 174 ); 158 175 159 176 // Merge new templates with existing stack 160 177 // @see bp_get_theme_compat_templates(). 161 $templates = array_merge( (array) $new_templates, $templates ); 162 163 return $templates; 178 return array_merge( $new_templates, $templates ); 164 179 } 165 180 … … 178 193 } 179 194 180 bp_theme_compat_reset_post( array( 181 'ID' => 0, 182 'post_title' => $title, 183 'post_author' => 0, 184 'post_date' => 0, 185 'post_content' => '', 186 'post_type' => 'page', 187 'post_status' => 'publish', 188 'is_page' => true, 189 'comment_status' => 'closed' 190 ) ); 195 bp_theme_compat_reset_post( 196 array( 197 'ID' => 0, 198 'post_title' => $title, 199 'post_author' => 0, 200 'post_date' => 0, 201 'post_content' => '', 202 'post_type' => 'page', 203 'post_status' => 'publish', 204 'is_page' => true, 205 'comment_status' => 'closed', 206 ) 207 ); 191 208 } 192 209 … … 195 212 * 196 213 * @since 1.7.0 214 * 215 * @return string|null 197 216 */ 198 217 public function create_content() {
Note: See TracChangeset
for help on using the changeset viewer.