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-members/bp-members-screens.php

    r6285 r6395  
    264264
    265265/**
    266  * The main theme compat class for BuddyPress Groups
     266 * The main theme compat class for BuddyPress Members.
    267267 *
    268268 * This class sets up the necessary theme compatability actions to safely output
     
    274274
    275275    /**
    276      * Setup the groups component theme compatibility
     276     * Setup the members component theme compatibility
    277277     *
    278278     * @since BuddyPress (1.7)
     
    283283
    284284    /**
    285      * Are we looking at something that needs group theme compatability?
     285     * Are we looking at something that needs members theme compatability?
    286286     *
    287287     * @since BuddyPress (1.7)
     
    289289    public function is_members() {
    290290
    291         // Bail if not looking at a group
    292         if ( ! bp_is_members_component() )
     291        // Bail if not looking at the members component or a user's page
     292        if ( ! bp_is_members_component() && ! bp_displayed_user_id() )
    293293            return;
    294294
    295         // Group Directory
     295        // Members Directory
    296296        if ( ! bp_current_action() && ! bp_current_item() ) {
    297297            bp_update_is_directory( true, 'members' );
    298298
    299             do_action( 'members_directory_groups_setup' );
     299            do_action( 'bp_members_screen_index' );
    300300
    301301            add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'directory_dummy_post' ) );
    302302            add_filter( 'bp_replace_the_content',                    array( $this, 'directory_content'    ) );
     303
     304        // User page
     305        } elseif ( bp_displayed_user_id() ) {
     306            add_action( 'bp_template_include_reset_dummy_post_data', array( $this, 'single_dummy_post'    ) );
     307            add_filter( 'bp_replace_the_content',                    array( $this, 'single_dummy_content' ) );
     308
    303309        }
    304310    }
     
    326332
    327333    /**
    328      * Filter the_content with the groups index template part
     334     * Filter the_content with the members index template part
    329335     *
    330336     * @since BuddyPress (1.7)
     
    333339        bp_buffer_template_part( 'members/index' );
    334340    }
     341
     342    /** Single ****************************************************************/
     343
     344    /**
     345     * Update the global $post with the displayed user's data
     346     *
     347     * @since BuddyPress (1.7)
     348     */
     349    public function single_dummy_post() {
     350        bp_theme_compat_reset_post( array(
     351            'ID'             => 0,
     352            'post_title'     => bp_get_displayed_user_fullname(),
     353            'post_author'    => 0,
     354            'post_date'      => 0,
     355            'post_content'   => '',
     356            'post_type'      => 'bp_members',
     357            'post_status'    => 'publish',
     358            'is_archive'     => true,
     359            'comment_status' => 'closed'
     360        ) );
     361    }
     362
     363    /**
     364     * Filter the_content with the members' single home template part
     365     *
     366     * @since BuddyPress (1.7)
     367     */
     368    public function single_dummy_content() {
     369        bp_buffer_template_part( 'members/single/home' );
     370    }
    335371}
    336372new BP_Members_Theme_Compat();
Note: See TracChangeset for help on using the changeset viewer.