Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/08/2012 09:16:00 AM (13 years ago)
Author:
r-a-y
Message:

Theme Compat:

  • Merge BP_XProfile_Theme_Compat class into the BP_Members_Theme_Compat class.
  • This was done because if the Extended Profiles module was disabled, theme compat would fail on a displayed user's page.
  • Fix PHPDoc in the BP_Members_Theme_Compat class.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-screens.php

    r6332 r6395  
    192192    bp_core_load_template( apply_filters( 'xprofile_template_change_avatar', 'members/single/home' ) );
    193193}
    194 
    195 /** Theme Compatability *******************************************************/
    196 
    197 /**
    198  * The main theme compat class for BuddyPress Profiles
    199  *
    200  * This class sets up the necessary theme compatability actions to safely output
    201  * group template parts to the_title and the_content areas of a theme.
    202  *
    203  * @since BuddyPress (1.7)
    204  */
    205 class BP_XProfile_Theme_Compat {
    206 
    207     /**
    208      * Setup the xprofile component theme compatibility
    209      *
    210      * @since BuddyPress (1.7)
    211      *
    212      * @todo is 'bp_screens' correct here?
    213      */
    214     public function __construct() {
    215         add_action( 'bp_setup_theme_compat', array( $this, 'is_xprofile' ) );
    216     }
    217 
    218     /**
    219      * Are we looking at something that needs group theme compatability?
    220      *
    221      * @since BuddyPress (1.7)
    222      */
    223     public function is_xprofile() {
    224 
    225         // Bail if not looking at a profile
    226         if ( ! bp_displayed_user_id() )
    227             return;
    228 
    229         // Creating a group
    230         add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'dummy_post'    ) );
    231         add_filter( 'bp_replace_the_content',                    array( $this, 'dummy_content' ) );
    232     }
    233 
    234     /** Directory *************************************************************/
    235 
    236     /**
    237      * Update the global $post with directory data
    238      *
    239      * @since BuddyPress (1.7)
    240      */
    241     public function dummy_post() {
    242         bp_theme_compat_reset_post( array(
    243             'ID'             => 0,
    244             'post_title'     => bp_get_displayed_user_fullname(),
    245             'post_author'    => 0,
    246             'post_date'      => 0,
    247             'post_content'   => '',
    248             'post_type'      => 'bp_xprofile',
    249             'post_status'    => 'publish',
    250             'is_archive'     => true,
    251             'comment_status' => 'closed'
    252         ) );
    253     }
    254 
    255     /**
    256      * Filter the_content with the groups index template part
    257      *
    258      * @since BuddyPress (1.7)
    259      */
    260     public function dummy_content() {
    261         bp_buffer_template_part( 'members/single/home' );
    262     }
    263 }
    264 new BP_XProfile_Theme_Compat();
Note: See TracChangeset for help on using the changeset viewer.