/** * Update the global $post with dummy data * * @since BuddyPress (1.7) */ public function dummy_post() { // Registration page if (mpp_is_gallery_directory()) { $title = __('Gallery Directory', 'mediapress'); } bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bp_get_directory_title('mediapress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => mpp_get_gallery_post_type(), 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed')); }
/** * Update the global $post with create screen data. * * @since BuddyPress (1.7.0) */ public function create_dummy_post() { // Title based on ability to create blogs if (is_user_logged_in() && bp_blog_signup_enabled()) { $title = '<a class="button bp-title-button" href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug()) . '">' . __('Sites', 'buddypress') . '</a> ' . __('Create a Site', 'buddypress'); } else { $title = __('Sites', 'buddypress'); } bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed')); }
/** * Update the global $post with single group data. * * @since 1.7.0 */ public function single_dummy_post() { bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bp_get_current_group_name(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed')); }
/** * Load a specific template file with fallback support. * * Example: * bp_core_load_template( 'members/index' ); * Loads: * wp-content/themes/[activated_theme]/members/index.php * * @param array $templates Array of templates to attempt to load. */ function bp_core_load_template($templates) { global $wp_query; // Reset the post. bp_theme_compat_reset_post(array('ID' => 0, 'is_404' => true, 'post_status' => 'publish')); // Set theme compat to false since the reset post function automatically sets // theme compat to true. bp_set_theme_compat_active(false); // Fetch each template and add the php suffix. $filtered_templates = array(); foreach ((array) $templates as $template) { $filtered_templates[] = $template . '.php'; } // Only perform template lookup for bp-default themes. if (!bp_use_theme_compat_with_current_theme()) { $template = locate_template((array) $filtered_templates, false); // Theme compat doesn't require a template lookup. } else { $template = ''; } /** * Filters the template locations. * * Allows plugins to alter where the template files are located. * * @since 1.1.0 * * @param string $template Located template path. * @param array $filtered_templates Array of templates to attempt to load. */ $located_template = apply_filters('bp_located_template', $template, $filtered_templates); if (!empty($located_template)) { // Template was located, lets set this as a valid page and not a 404. status_header(200); $wp_query->is_page = true; $wp_query->is_singular = true; $wp_query->is_404 = false; /** * Fires before the loading of a located template file. * * @since 1.6.0 * * @param string $located_template Template found to be loaded. */ do_action('bp_core_pre_load_template', $located_template); /** * Filters the selected template right before loading. * * @since 1.1.0 * * @param string $located_template Template found to be loaded. */ load_template(apply_filters('bp_load_template', $located_template)); /** * Fires after the loading of a located template file. * * @since 1.6.0 * * @param string $located_template Template found that was loaded. */ do_action('bp_core_post_load_template', $located_template); // Kill any other output after this. exit; // No template found, so setup theme compatibility. // @todo Some other 404 handling if theme compat doesn't kick in. } else { // We know where we are, so reset important $wp_query bits here early. // The rest will be done by bp_theme_compat_reset_post() later. if (is_buddypress()) { status_header(200); $wp_query->is_page = true; $wp_query->is_singular = true; $wp_query->is_404 = false; } /** * Fires if there are no found templates to load and theme compat is needed. * * @since 1.7.0 */ do_action('bp_setup_theme_compat'); } }
function buatp_dummy_post() { bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('', 'buddypress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_members', 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed')); }
/** * Update the global $post with directory data * * @package BuddyDrive Component * @subpackage Screens * @since 1.2.0 * * @uses bp_theme_compat_reset_post() to reset the post data */ public function directory_dummy_post() { bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => buddydrive_get_name(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed')); }
/** * Load a specific template file with fallback support. * * Example: * bp_core_load_template( 'members/index' ); * Loads: * wp-content/themes/[activated_theme]/members/index.php * * @param array $templates Array of templates to attempt to load. * @return bool|null Returns false on failure. */ function bp_core_load_template($templates) { global $wp_query; // check if BP page belongs to, or is a child of, a BP directory page $page_id = false; foreach ((array) buddypress()->pages as $page) { if ($page->name == buddypress()->unfiltered_uri[buddypress()->unfiltered_uri_offset]) { $page_id = $page->id; break; } } // Set up reset post args $reset_post_args = array('is_404' => true, 'post_status' => 'publish'); // BP page exists - fill in the $wp_query->post object // // bp_theme_compat_reset_post() looks at the $wp_query->post object to fill in // the post globals if (!empty($page_id)) { $wp_query->post = get_post($page_id); $reset_post_args['ID'] = $page_id; } else { $reset_post_args['ID'] = 0; } // Reset the post bp_theme_compat_reset_post($reset_post_args); // Set theme compat to false since the reset post function automatically sets // theme compat to true bp_set_theme_compat_active(false); // Fetch each template and add the php suffix $filtered_templates = array(); foreach ((array) $templates as $template) { $filtered_templates[] = $template . '.php'; } // Only perform template lookup for bp-default themes if (!bp_use_theme_compat_with_current_theme()) { $template = locate_template((array) $filtered_templates, false); // Theme compat doesn't require a template lookup } else { $template = ''; } // Filter the template locations so that plugins can alter where they are located $located_template = apply_filters('bp_located_template', $template, $filtered_templates); if (!empty($located_template)) { // Template was located, lets set this as a valid page and not a 404. status_header(200); $wp_query->is_page = true; $wp_query->is_singular = true; $wp_query->is_404 = false; do_action('bp_core_pre_load_template', $located_template); load_template(apply_filters('bp_load_template', $located_template)); do_action('bp_core_post_load_template', $located_template); // Kill any other output after this. exit; // No template found, so setup theme compatability // @todo Some other 404 handling if theme compat doesn't kick in } else { // We know where we are, so reset important $wp_query bits here early. // The rest will be done by bp_theme_compat_reset_post() later. if (is_buddypress()) { status_header(200); $wp_query->is_page = true; $wp_query->is_singular = true; $wp_query->is_404 = false; } do_action('bp_setup_theme_compat'); } }
/** * Update the global $post with directory data * * @since BuddyPress (1.7) */ public function place_home_dummy_post() { bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Search Places', 'bp-checkins'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_checkins', 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed')); }
/** * Update the global $post with the displayed user's data. * * @since 1.7.0 */ public function single_dummy_post() { bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Activity', 'buddypress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed')); }
/** * Update the global $post with directory data */ public function directory_dummy_post() { bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => apply_filters('task_breaker_projects_dir_title', __('Projects Directory', 'task_breaker')), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_projects', 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed')); }
/** * Update the global $post with dummy data regarding doc creation * * @since 1.3 */ public function create_dummy_post() { bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Create a Doc', 'bp-docs'), 'post_author' => get_current_user_id(), 'post_date' => 0, 'post_content' => '', 'post_type' => bp_docs_get_post_type_name(), 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed')); }
/** * Update the global $post with create screen data. * * @since 1.7.0 */ public function create_dummy_post() { // Title based on ability to create blogs. if (is_user_logged_in() && bp_blog_signup_enabled()) { $title = __('Create a Site', 'buddypress'); } else { $title = __('Sites', 'buddypress'); } bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed')); }
/** * Update the global $post with single group data * * @since BuddyPress (1.7) */ public function single_dummy_post() { bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => '<a href="' . bp_get_group_permalink(groups_get_current_group()) . '">' . bp_get_current_group_name() . '</a>', 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_group', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed')); }
/** * Load a specific template file with fallback support. * * Example: * bp_core_load_template( 'members/index' ); * Loads: * wp-content/themes/[activated_theme]/members/index.php * * @param array $templates Array of templates to attempt to load. * @return bool|null Returns false on failure. */ function bp_core_load_template( $templates ) { global $wp_query; // Reset the post bp_theme_compat_reset_post( array( 'ID' => 0, 'is_404' => true, 'post_status' => 'publish', ) ); // Set theme compat to false since the reset post function automatically sets // theme compat to true bp_set_theme_compat_active( false ); // Fetch each template and add the php suffix $filtered_templates = array(); foreach ( (array) $templates as $template ) { $filtered_templates[] = $template . '.php'; } // Only perform template lookup for bp-default themes if ( ! bp_use_theme_compat_with_current_theme() ) { $template = locate_template( (array) $filtered_templates, false ); // Theme compat doesn't require a template lookup } else { $template = ''; } // Filter the template locations so that plugins can alter where they are located $located_template = apply_filters( 'bp_located_template', $template, $filtered_templates ); if ( !empty( $located_template ) ) { // Template was located, lets set this as a valid page and not a 404. status_header( 200 ); $wp_query->is_page = true; $wp_query->is_singular = true; $wp_query->is_404 = false; do_action( 'bp_core_pre_load_template', $located_template ); load_template( apply_filters( 'bp_load_template', $located_template ) ); do_action( 'bp_core_post_load_template', $located_template ); // Kill any other output after this. exit(); // No template found, so setup theme compatibility // @todo Some other 404 handling if theme compat doesn't kick in } else { // We know where we are, so reset important $wp_query bits here early. // The rest will be done by bp_theme_compat_reset_post() later. if ( is_buddypress() ) { status_header( 200 ); $wp_query->is_page = true; $wp_query->is_singular = true; $wp_query->is_404 = false; } do_action( 'bp_setup_theme_compat' ); } }
/** * Update the global $post with dummy data. * * @since BuddyPress (1.7.0) */ public function dummy_post() { // Registration page if (bp_is_register_page()) { $title = __('Create an Account', 'buddypress'); if ('completed-confirmation' == bp_get_current_signup_step()) { $title = __('Check Your Email To Activate Your Account!', 'buddypress'); } // Activation page } else { $title = __('Activate your Account', 'buddypress'); if (bp_account_was_activated()) { $title = __('Account Activated', 'buddypress'); } } bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed')); }
/** * Update the global $post with directory data. * * @since 1.7.0 */ public function directory_dummy_post() { // Title based on ability to create groups. if (is_user_logged_in()) { $title = __('Forums', 'buddypress') . ' <a class="button show-hide-new bp-title-button" href="#new-topic" id="new-topic-button">' . __('New Topic', 'buddypress') . '</a>'; } else { $title = __('Forums', 'buddypress'); } bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed')); }
/** * Setup WordPress theme compat */ function bp_links_setup_theme_compat() { // links component and is directory? if (bp_is_current_component('links')) { // no action and no item? if (!bp_current_action() && !bp_current_item() || BP_LINKS_CAT_URL_SLUG === bp_current_action() && bp_action_variable()) { // set up dummy post bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Links', 'buddypress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_link', 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed')); // hook up replace content filter add_filter('bp_replace_the_content', 'bp_links_screen_directory_index'); } elseif (bp_is_current_action('create') && !bp_is_user()) { // set up dummy post bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Links', 'buddypress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_link', 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed')); // hook up replace content filter add_filter('bp_replace_the_content', 'bp_links_screen_directory_create'); } elseif (bp_is_single_item()) { // set up dummy post bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Links', 'buddypress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_link', 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed')); // hook up replace content filter add_filter('bp_replace_the_content', 'bp_links_screen_directory_single'); } } }