Changeset 3488 for trunk/bp-themes/bp-default/functions.php
- Timestamp:
- 11/27/2010 10:21:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-themes/bp-default/functions.php
r3462 r3488 155 155 156 156 /** 157 * Filter the dropdown for selecting the page to show on front to include "Activity Stream" 158 * 157 * In BuddyPress 1.2.x, this function filtered the dropdown on the Settings > Reading screen for selecting 158 * the page to show on front to include "Activity Stream." 159 * As of 1.3.x, it is no longer required. 160 * 161 * @deprecated 1.3 162 * @deprecated No longer required. 159 163 * @param string $page_html A list of pages as a dropdown (select list) 164 * @return string 160 165 * @see wp_dropdown_pages() 161 * @return string162 * @package BuddyPress Theme163 166 * @since 1.2 164 167 */ 165 168 function bp_dtheme_wp_pages_filter( $page_html ) { 166 if ( !bp_is_active( 'activity' ) ) 167 return $page_html; 168 169 if ( 'page_on_front' != substr( $page_html, 14, 13 ) ) 170 return $page_html; 171 172 $selected = false; 173 $page_html = str_replace( '</select>', '', $page_html ); 174 175 if ( bp_dtheme_page_on_front() == 'activity' ) 176 $selected = ' selected="selected"'; 177 178 $page_html .= '<option class="level-0" value="activity"' . $selected . '>' . __( 'Activity Stream', 'buddypress' ) . '</option></select>'; 169 _deprecated_function( __FUNCTION__, '1.3', "No longer required." ); 179 170 return $page_html; 180 171 } 181 add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' ); 182 183 /** 184 * Hijack the saving of page on front setting to save the activity stream setting 185 * 172 173 /** 174 * In BuddyPress 1.2.x, this function hijacked the saving of page on front setting to save the activity stream setting. 175 * As of 1.3.x, it is no longer required. 176 * 177 * @deprecated 1.3 178 * @deprecated No longer required. 186 179 * @param $string $oldvalue Previous value of get_option( 'page_on_front' ) 187 180 * @param $string $oldvalue New value of get_option( 'page_on_front' ) 188 181 * @return string 189 * @package BuddyPress Theme190 182 * @since 1.2 191 183 */ 192 184 function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) { 185 _deprecated_function( __FUNCTION__, '1.3', "No longer required." ); 193 186 if ( !is_admin() || !is_super_admin() ) 194 187 return false; 195 188 196 if ( 'activity' == $_POST['page_on_front'] ) 197 return 'activity'; 198 else 199 return $oldvalue; 200 } 201 add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 ); 202 203 /** 204 * Load the activity stream template if settings allow 205 * 189 return $oldvalue; 190 } 191 192 /** 193 * In BuddyPress 1.2.x, this function loaded the activity stream template if the front page display settings allow. 194 * As of 1.3.x, it is no longer required. 195 * 196 * @deprecated 1.3 197 * @deprecated No longer required. 206 198 * @param string $template Absolute path to the page template 207 199 * @return string 208 * @global WP_Query $wp_query WordPress query object209 * @package BuddyPress Theme210 200 * @since 1.2 211 201 */ 212 202 function bp_dtheme_page_on_front_template( $template ) { 213 global $wp_query; 214 215 if ( empty( $wp_query->post->ID ) ) 216 return locate_template( array( 'activity/index.php' ), false ); 217 else 218 return $template; 219 } 220 add_filter( 'page_template', 'bp_dtheme_page_on_front_template' ); 203 _deprecated_function( __FUNCTION__, '1.3', "No longer required." ); 204 return $template; 205 } 221 206 222 207 /** … … 224 209 * 225 210 * @return false|int ID of page set as the home page 226 * @package BuddyPress Theme227 211 * @since 1.2 228 212 */ … … 235 219 236 220 /** 237 * Force the page ID as a string to stop the get_posts query from kicking up a fuss. 238 * 239 * @global WP_Query $wp_query WordPress query object 240 * @package BuddyPress Theme 221 * In BuddyPress 1.2.x, this forced the page ID as a string to stop the get_posts query from kicking up a fuss. 222 * As of 1.3.x, it is no longer required. 223 * 224 * @deprecated 1.3 225 * @deprecated No longer required. 241 226 * @since 1.2 242 227 */ 243 228 function bp_dtheme_fix_get_posts_on_activity_front() { 244 global $wp_query; 245 246 if ( !empty($wp_query->query_vars['page_id']) && 'activity' == $wp_query->query_vars['page_id'] ) 247 $wp_query->query_vars['page_id'] = '"activity"'; 248 } 249 add_action( 'pre_get_posts', 'bp_dtheme_fix_get_posts_on_activity_front' ); 250 251 /** 252 * WP 3.0 requires there to be a non-null post in the posts array 253 * 229 _deprecated_function( __FUNCTION__, '1.3', "No longer required." ); 230 } 231 232 /** 233 * In BuddyPress 1.3, this was used as part of the code that set the activity stream to be on the front page. 234 * As of 1.3.x, it is no longer required. 235 * 236 * @deprecated 1.3 237 * @deprecated No longer required. 254 238 * @param array $posts Posts as retrieved by WP_Query 255 * @global WP_Query $wp_query WordPress query object256 239 * @return array 257 * @package BuddyPress Theme258 240 * @since 1.2.5 259 241 */ 260 242 function bp_dtheme_fix_the_posts_on_activity_front( $posts ) { 261 global $wp_query; 262 263 // NOTE: the double quotes around '"activity"' are thanks to our previous function bp_dtheme_fix_get_posts_on_activity_front() 264 if ( empty( $posts ) && !empty( $wp_query->query_vars['page_id'] ) && '"activity"' == $wp_query->query_vars['page_id'] ) 265 $posts = array( (object) array( 'ID' => 'activity' ) ); 266 243 _deprecated_function( __FUNCTION__, '1.3', "No longer required." ); 267 244 return $posts; 268 245 } 269 add_filter( 'the_posts', 'bp_dtheme_fix_the_posts_on_activity_front' );270 246 271 247 /** … … 406 382 ?> 407 383 <ul id="nav"> 408 <li<?php if ( bp_is_front_page() ) : ?> class="selected"<?php endif; ?>>384 <li<?php if ( is_front_page() ) : ?> class="selected"<?php endif; ?>> 409 385 <a href="<?php echo site_url() ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a> 410 386 </li>
Note: See TracChangeset
for help on using the changeset viewer.