Changeset 9157 for trunk/src/bp-groups/bp-groups-screens.php
- Timestamp:
- 11/21/2014 06:24:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-screens.php
r9027 r9157 1100 1100 */ 1101 1101 public function directory_dummy_post() { 1102 1103 $title = apply_filters( 'bp_groups_directory_header', bp_get_directory_title( 'groups' ) ); 1102 bp_theme_compat_reset_post( array( 1103 'ID' => 0, 1104 'post_title' => bp_get_directory_title( 'groups' ), 1105 'post_author' => 0, 1106 'post_date' => 0, 1107 'post_content' => '', 1108 'post_type' => 'page', 1109 'post_status' => 'publish', 1110 'is_page' => true, 1111 'comment_status' => 'closed' 1112 ) ); 1113 } 1114 1115 /** 1116 * Filter the_content with the groups index template part. 1117 * 1118 * @since BuddyPress (1.7.0) 1119 */ 1120 public function directory_content() { 1121 return bp_buffer_template_part( 'groups/index', null, false ); 1122 } 1123 1124 /** Create ************************************************************/ 1125 1126 /** 1127 * Add custom template hierarchy to theme compat for the group create page. 1128 * 1129 * This is to mirror how WordPress has 1130 * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}. 1131 * 1132 * @since BuddyPress (1.8.0) 1133 * 1134 * @param string $templates The templates from bp_get_theme_compat_templates(). 1135 * @return array $templates Array of custom templates to look for. 1136 */ 1137 public function create_template_hierarchy( $templates ) { 1138 // Setup our templates based on priority 1139 $new_templates = apply_filters( 'bp_template_hierarchy_groups_create', array( 1140 'groups/index-create.php' 1141 ) ); 1142 1143 // Merge new templates with existing stack 1144 // @see bp_get_theme_compat_templates() 1145 $templates = array_merge( $new_templates, $templates ); 1146 1147 return $templates; 1148 } 1149 1150 /** 1151 * Update the global $post with create screen data. 1152 * 1153 * @since BuddyPress (1.7.0) 1154 */ 1155 public function create_dummy_post() { 1156 1157 $title = _x( 'Groups', 'Group creation page', 'buddypress' ); 1104 1158 1105 1159 bp_theme_compat_reset_post( array( … … 1117 1171 1118 1172 /** 1119 * Filter the_content with the groups indextemplate part.1173 * Filter the_content with the create screen template part. 1120 1174 * 1121 1175 * @since BuddyPress (1.7.0) 1122 1176 */ 1123 public function directory_content() {1124 return bp_buffer_template_part( 'groups/ index', null, false );1125 } 1126 1127 /** Create ************************************************************/1177 public function create_content() { 1178 return bp_buffer_template_part( 'groups/create', null, false ); 1179 } 1180 1181 /** Single ************************************************************/ 1128 1182 1129 1183 /** 1130 * Add custom template hierarchy to theme compat for the group create page.1184 * Add custom template hierarchy to theme compat for group pages. 1131 1185 * 1132 1186 * This is to mirror how WordPress has … … 1138 1192 * @return array $templates Array of custom templates to look for. 1139 1193 */ 1140 public function create_template_hierarchy( $templates ) { 1194 public function single_template_hierarchy( $templates ) { 1195 // Setup some variables we're going to reference in our custom templates 1196 $group = groups_get_current_group(); 1197 1141 1198 // Setup our templates based on priority 1142 $new_templates = apply_filters( 'bp_template_hierarchy_groups_create', array( 1143 'groups/index-create.php' 1199 $new_templates = apply_filters( 'bp_template_hierarchy_groups_single_item', array( 1200 'groups/single/index-id-' . sanitize_file_name( bp_get_current_group_id() ) . '.php', 1201 'groups/single/index-slug-' . sanitize_file_name( bp_get_current_group_slug() ) . '.php', 1202 'groups/single/index-action-' . sanitize_file_name( bp_current_action() ) . '.php', 1203 'groups/single/index-status-' . sanitize_file_name( $group->status ) . '.php', 1204 'groups/single/index.php' 1144 1205 ) ); 1145 1206 1146 1207 // Merge new templates with existing stack 1147 1208 // @see bp_get_theme_compat_templates() 1148 $templates = array_merge( $new_templates, $templates );1209 $templates = array_merge( (array) $new_templates, $templates ); 1149 1210 1150 1211 return $templates; … … 1152 1213 1153 1214 /** 1154 * Update the global $post with create screendata.1215 * Update the global $post with single group data. 1155 1216 * 1156 1217 * @since BuddyPress (1.7.0) 1157 1218 */ 1158 public function create_dummy_post() { 1159 1160 $title = _x( 'Groups', 'Group creation page', 'buddypress' ); 1161 1219 public function single_dummy_post() { 1162 1220 bp_theme_compat_reset_post( array( 1163 1221 'ID' => 0, 1164 'post_title' => $title,1222 'post_title' => bp_get_current_group_name(), 1165 1223 'post_author' => 0, 1166 1224 'post_date' => 0, … … 1174 1232 1175 1233 /** 1176 * Filter the_content with the create screen template part.1177 *1178 * @since BuddyPress (1.7.0)1179 */1180 public function create_content() {1181 return bp_buffer_template_part( 'groups/create', null, false );1182 }1183 1184 /** Single ************************************************************/1185 1186 /**1187 * Add custom template hierarchy to theme compat for group pages.1188 *1189 * This is to mirror how WordPress has1190 * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.1191 *1192 * @since BuddyPress (1.8.0)1193 *1194 * @param string $templates The templates from bp_get_theme_compat_templates().1195 * @return array $templates Array of custom templates to look for.1196 */1197 public function single_template_hierarchy( $templates ) {1198 // Setup some variables we're going to reference in our custom templates1199 $group = groups_get_current_group();1200 1201 // Setup our templates based on priority1202 $new_templates = apply_filters( 'bp_template_hierarchy_groups_single_item', array(1203 'groups/single/index-id-' . sanitize_file_name( bp_get_current_group_id() ) . '.php',1204 'groups/single/index-slug-' . sanitize_file_name( bp_get_current_group_slug() ) . '.php',1205 'groups/single/index-action-' . sanitize_file_name( bp_current_action() ) . '.php',1206 'groups/single/index-status-' . sanitize_file_name( $group->status ) . '.php',1207 'groups/single/index.php'1208 ) );1209 1210 // Merge new templates with existing stack1211 // @see bp_get_theme_compat_templates()1212 $templates = array_merge( (array) $new_templates, $templates );1213 1214 return $templates;1215 }1216 1217 /**1218 * Update the global $post with single group data.1219 *1220 * @since BuddyPress (1.7.0)1221 */1222 public function single_dummy_post() {1223 bp_theme_compat_reset_post( array(1224 'ID' => 0,1225 'post_title' => '<a href="' . bp_get_group_permalink( groups_get_current_group() ) . '">' . bp_get_current_group_name() . '</a>',1226 'post_author' => 0,1227 'post_date' => 0,1228 'post_content' => '',1229 'post_type' => 'page',1230 'post_status' => 'publish',1231 'is_page' => true,1232 'comment_status' => 'closed'1233 ) );1234 }1235 1236 /**1237 1234 * Filter the_content with the single group template part. 1238 1235 *
Note: See TracChangeset
for help on using the changeset viewer.