• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bp_core_get_directory_page_ids函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中bp_core_get_directory_page_ids函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_get_directory_page_ids函数的具体用法?PHP bp_core_get_directory_page_ids怎么用?PHP bp_core_get_directory_page_ids使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了bp_core_get_directory_page_ids函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_item

 /**
  * get_item function.
  *
  * returns data about a BuddyPress site
  * 
  * @access public
  * @param mixed $request
  * @return void
  */
 public function get_item($request)
 {
     global $bp;
     $core = array('version' => $bp->version, 'active_components' => $bp->active_components, 'directory_page_ids' => bp_core_get_directory_page_ids());
     $core = apply_filters('core_api_data_filter', $core);
     $response = new WP_REST_Response();
     $response->set_data($core);
     $response = rest_ensure_response($response);
     return $response;
 }
开发者ID:Ritesh-patel,项目名称:BP-API,代码行数:19,代码来源:bp-api-core.php


示例2: fix_registration

 /**
  * Fixes the ProSites checkout if BuddyPress registration page is set to checkout page
  */
 public static function fix_registration()
 {
     global $psts;
     if (function_exists('bp_core_get_directory_page_ids')) {
         $bp_directory_page_ids = bp_core_get_directory_page_ids();
         if (!empty($bp_directory_page_ids['register'])) {
             $register_url = get_permalink($bp_directory_page_ids['register']);
         }
         if (bp_is_current_component('register') && $register_url == $psts->checkout_url()) {
             remove_action('bp_init', 'bp_core_wpsignup_redirect');
             remove_action('bp_screens', 'bp_core_screen_signup');
         }
     }
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:17,代码来源:BuddyPress.php


示例3: bp_core_clear_directory_pages_cache_page_edit

/**
 * Clear the directory_pages cache when one of the pages is updated.
 *
 * @since BuddyPress (2.0.0)
 *
 * @param int $post_id
 */
function bp_core_clear_directory_pages_cache_page_edit($post_id)
{
    if (!bp_is_root_blog()) {
        return;
    }
    // Bail if BP is not defined here
    if (!buddypress()) {
        return;
    }
    $page_ids = bp_core_get_directory_page_ids('all');
    if (!in_array($post_id, (array) $page_ids)) {
        return;
    }
    wp_cache_delete('directory_pages', 'bp');
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:22,代码来源:bp-core-cache.php


示例4: bps_add_form

function bps_add_form()
{
    global $post;
    $page = $post->ID;
    if ($page == 0) {
        $bp_pages = bp_core_get_directory_page_ids();
        $page = $bp_pages['members'];
    }
    $len = strlen((string) $page);
    $args = array('post_type' => 'bps_form', 'orderby' => 'ID', 'order' => 'ASC', 'nopaging' => true, 'meta_query' => array(array('key' => 'bps_options', 'value' => 's:9:"directory";s:3:"Yes";', 'compare' => 'LIKE'), array('key' => 'bps_options', 'value' => "s:6:\"action\";s:{$len}:\"{$page}\";", 'compare' => 'LIKE')));
    $args = apply_filters('bps_form_order', $args);
    $posts = get_posts($args);
    foreach ($posts as $post) {
        $meta = bps_meta($post->ID);
        $template = $meta['template'];
        bps_display_form($post->ID, $template, 'directory');
    }
}
开发者ID:quyip8818,项目名称:wps,代码行数:18,代码来源:bps-form.php


示例5: add_steps

 function add_steps()
 {
     global $nxt_rewrite;
     // Setup wizard steps
     $steps = array();
     if ('install' == $this->setup_type) {
         $steps = array(__('Components', 'buddypress'), __('Pages', 'buddypress'), __('Permalinks', 'buddypress'), __('Theme', 'buddypress'), __('Finish', 'buddypress'));
         // Update wizard steps
     } else {
         if ($this->is_network_activate) {
             $steps[] = __('Multisite Update', 'buddypress');
         }
         if ($this->database_version < (int) $this->new_version) {
             $steps[] = __('Database Update', 'buddypress');
         }
         if ($this->database_version < 1801 || !bp_core_get_directory_page_ids()) {
             $steps[] = __('Components', 'buddypress');
             $steps[] = __('Pages', 'buddypress');
         }
         $steps[] = __('Finish', 'buddypress');
     }
     return $steps;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:23,代码来源:bp-core-update.php


示例6: test_should_return_false_for_invalid_component

 public function test_should_return_false_for_invalid_component()
 {
     $found = bp_core_get_directory_page_id('foo');
     $pages = bp_core_get_directory_page_ids();
     $this->assertFalse($found);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:6,代码来源:bpCoreGetDirectoryPageId.php


示例7: check_positive_pages

 function check_positive_pages($posts)
 {
     global $wp_query, $M_options;
     $component = bp_current_component();
     if (count($posts) > 1) {
         return $posts;
     }
     if (!empty($component)) {
         // we may be on a restricted post so check the URL and redirect if needed
         $redirect = false;
         $url = '';
         $exclude = array();
         if (!empty($M_options['registration_page'])) {
             $exclude[] = get_permalink((int) $M_options['registration_page']);
             $exclude[] = untrailingslashit(get_permalink((int) $M_options['registration_page']));
         }
         if (!empty($M_options['account_page'])) {
             $exclude[] = get_permalink((int) $M_options['account_page']);
             $exclude[] = untrailingslashit(get_permalink((int) $M_options['account_page']));
         }
         if (!empty($M_options['nocontent_page'])) {
             $exclude[] = get_permalink((int) $M_options['nocontent_page']);
             $exclude[] = untrailingslashit(get_permalink((int) $M_options['nocontent_page']));
         }
         if (!empty($wp_query->query_vars['protectedfile']) && !$forceviewing) {
             $exclude[] = $host;
             $exclude[] = untrailingslashit($host);
         }
         $existing_pages = bp_core_get_directory_page_ids();
         if (!in_array(strtolower(get_permalink($existing_pages[$component])), $exclude)) {
             $url = get_permalink($existing_pages[$component]);
         }
         // Check if we have a url available to check
         if (empty($url)) {
             return $posts;
         }
         // we have the current page / url - get the groups selected
         $group_id = $this->get_group();
         if ($group_id) {
             $group = new M_Urlgroup($group_id);
             if (!$group->url_matches($url)) {
                 $redirect = true;
             }
         }
         if ($redirect === true && !empty($M_options['nocontent_page'])) {
             // we need to redirect
             $this->redirect();
         } else {
             return $posts;
         }
     }
     return $posts;
 }
开发者ID:hscale,项目名称:webento,代码行数:53,代码来源:default.bprules.php


示例8: bp_core_admin_page_options

/**
 * Creates reusable markup for page setup on the Components and Pages dashboard panel.
 *
 * This markup has been abstracted so that it can be used both during the setup wizard as well as
 * when BP has been fully installed.
 *
 * @package BuddyPress Core
 * @since 1.5
 */
function bp_core_admin_page_options()
{
    global $bp;
    // Get the existing nxt pages
    $existing_pages = bp_core_get_directory_page_ids();
    // Set up an array of components (along with component names) that have
    // directory pages.
    $directory_pages = array();
    foreach ($bp->loaded_components as $component_slug => $component_id) {
        // Only components that need directories should be listed here
        if (isset($bp->{$component_id}) && !empty($bp->{$component_id}->has_directory)) {
            // component->name was introduced in BP 1.5, so we must provide a fallback
            $component_name = !empty($bp->{$component_id}->name) ? $bp->{$component_id}->name : ucwords($component_id);
            $directory_pages[$component_id] = $component_name;
        }
    }
    $directory_pages = apply_filters('bp_directory_pages', $directory_pages);
    ?>

	<h3><?php 
    _e('Directories', 'buddypress');
    ?>
</h3>

	<p><?php 
    _e('Associate a NXTClass Page with each BuddyPress component directory.', 'buddypress');
    ?>
</p>

	<table class="form-table">
		<tbody>

			<?php 
    foreach ($directory_pages as $name => $label) {
        ?>
				<?php 
        $disabled = !bp_is_active($name) ? ' disabled="disabled"' : '';
        ?>

				<tr valign="top">
					<th scope="row">
						<label for="bp_pages[<?php 
        echo esc_attr($name);
        ?>
]"><?php 
        echo esc_html($label);
        ?>
</label>
					</th>

					<td>
						<?php 
        if (!bp_is_root_blog()) {
            switch_to_blog(bp_get_root_blog_id());
        }
        ?>

						<?php 
        echo nxt_dropdown_pages(array('name' => 'bp_pages[' . esc_attr($name) . ']', 'echo' => false, 'show_option_none' => __('- None -', 'buddypress'), 'selected' => !empty($existing_pages[$name]) ? $existing_pages[$name] : false));
        ?>

						<a href="<?php 
        echo admin_url(add_query_arg(array('post_type' => 'page'), 'post-new.php'));
        ?>
" class="button-secondary"><?php 
        _e('New Page');
        ?>
</a>
						<input class="button-primary" type="submit" name="bp-admin-pages-single" value="<?php 
        _e('Save', 'buddypress');
        ?>
" />

						<?php 
        if (!empty($existing_pages[$name])) {
            ?>

							<a href="<?php 
            echo get_permalink($existing_pages[$name]);
            ?>
" class="button-secondary" target="_bp"><?php 
            _e('View');
            ?>
</a>

						<?php 
        }
        ?>

						<?php 
        if (!bp_is_root_blog()) {
//.........这里部分代码省略.........
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:101,代码来源:bp-core-admin.php


示例9: yit_fix_bp_comments_list

 function yit_fix_bp_comments_list($comments, $post_id)
 {
     global $wp_query;
     $post = $wp_query->get_queried_object();
     if (in_array($post->ID, bp_core_get_directory_page_ids())) {
         return array();
     }
     return $comments;
 }
开发者ID:lieison,项目名称:IndustriasFenix,代码行数:9,代码来源:functions-theme.php


示例10: validate_positive

 public function validate_positive($args = null)
 {
     $component = bp_current_component();
     if ($component) {
         $pages = bp_core_get_directory_page_ids();
         if (!empty($pages[$component])) {
             return in_array($pages[$component], $this->data);
         }
     }
     return parent::validate_positive();
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:11,代码来源:Pages.php


示例11: add_filter

 public function test_bp_core_get_directory_page_ids_should_not_contain_register_and_activet_pages_when_registration_is_closed()
 {
     // Make sure the pages exist, to verify they're filtered out.
     add_filter('bp_get_signup_allowed', '__return_true', 999);
     $ac = buddypress()->active_components;
     bp_core_add_page_mappings(array_keys($ac));
     remove_filter('bp_get_signup_allowed', '__return_true', 999);
     // Get page ids
     $page_ids = bp_core_get_directory_page_ids();
     // Need to delete these pages as previously created.
     wp_delete_post($page_ids['register'], true);
     wp_delete_post($page_ids['activate'], true);
     add_filter('bp_get_signup_allowed', '__return_false', 999);
     bp_core_add_page_mappings(array_keys($ac));
     $page_ids = bp_core_get_directory_page_ids();
     remove_filter('bp_get_signup_allowed', '__return_false', 999);
     $page_names = array_keys($page_ids);
     $this->assertNotContains('register', $page_names);
     $this->assertNotContains('activate', $page_names);
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:20,代码来源:bpCoreGetDirectoryPageIds.php


示例12: step_pages_save

 function step_pages_save()
 {
     global $wpdb;
     if (isset($_POST['submit']) && isset($_POST['bp_pages'])) {
         check_admin_referer('bpwizard_pages');
         // Make sure that the pages are created on the bp_get_root_blog_id(), no matter which Dashboard the setup is being run on
         if (!empty($wpdb->blogid) && $wpdb->blogid != bp_get_root_blog_id() && !defined('BP_ENABLE_MULTIBLOG')) {
             switch_to_blog(bp_get_root_blog_id());
         }
         // Delete any existing pages
         $existing_pages = bp_core_get_directory_page_ids();
         foreach ((array) $existing_pages as $page_id) {
             wp_delete_post($page_id, true);
         }
         $blog_pages = $this->setup_pages((array) $_POST['bp_pages']);
         bp_update_option('bp-pages', $blog_pages);
         if (!empty($wpdb->blogid) && $wpdb->blogid != bp_get_root_blog_id() && !defined('BP_ENABLE_MULTIBLOG')) {
             restore_current_blog();
         }
         return true;
     }
     return false;
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:23,代码来源:bp-core-update.php


示例13: buddydrive_deactivation

/**
 * Handles plugin deactivation
 *
 * @uses bp_core_get_directory_page_ids() to get the BuddyPress component page ids
 * @uses buddydrive_get_slug() to get BuddyDrive slug
 * @uses wp_delete_post() to eventually delete the BuddyDrive page
 * @uses bp_core_update_directory_page_ids() to update the BuddyPres component pages ids
 */
function buddydrive_deactivation()
{
    // Bail if config does not match what we need
    if (buddydrive::bail()) {
        return;
    }
    $directory_pages = bp_core_get_directory_page_ids();
    $buddydrive_slug = buddydrive_get_slug();
    if (!empty($directory_pages[$buddydrive_slug])) {
        // let's remove the page as the plugin is deactivated.
        $buddydrive_page_id = $directory_pages[$buddydrive_slug];
        wp_delete_post($buddydrive_page_id, true);
        unset($directory_pages[$buddydrive_slug]);
        bp_core_update_directory_page_ids($directory_pages);
    }
    do_action('buddydrive_deactivation');
}
开发者ID:MrVibe,项目名称:buddydrive,代码行数:25,代码来源:buddydrive-functions.php


示例14: bp_core_create_root_component_page

function bp_core_create_root_component_page()
{
    global $bp;
    $new_page_ids = array();
    foreach ((array) $bp->add_root as $slug) {
        $new_page_ids[$slug] = wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords($slug), 'post_status' => 'publish', 'post_type' => 'page'));
    }
    $page_ids = array_merge((array) $new_page_ids, (array) bp_core_get_directory_page_ids());
    bp_core_update_directory_page_ids($page_ids);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:10,代码来源:bp-core-functions.php


示例15: buildDirectoryPages

 /**
  * Generates the BP component pages array
  *
  * @version 1.0
  * @since 1.0
  * @param array $flat_pages | Flat array of all WordPress pages on the site
  * @return obj $pages | Exception on failure. Structured object containing page ID's, Names, and Slugs on success.
  */
 function buildDirectoryPages($flat_pages)
 {
     if (empty($flat_pages)) {
         throw new FOX_exception(array('numeric' => 1, 'text' => "Called with empty flat_pages array", 'file' => __FILE__, 'line' => __LINE__, 'method' => __METHOD__, 'child' => null));
     }
     $page_ids = (array) bp_core_get_directory_page_ids();
     if (empty($page_ids)) {
         throw new FOX_exception(array('numeric' => 2, 'text' => "BP core directory page ids option is empty", 'file' => __FILE__, 'line' => __LINE__, 'method' => __METHOD__, 'child' => null));
     }
     $pages = new stdClass();
     // Iterate through each entry in the BP pages config option
     foreach ($page_ids as $component_id => $bp_page_id) {
         // Iterate through each WP site page in the flat pages array
         foreach ($flat_pages as $wp_page_id => $data) {
             // If the page ids match, add this page to the components array
             if ($wp_page_id == $bp_page_id) {
                 $pages->{$component_id}->name = $data['slug'];
                 $pages->{$component_id}->id = $wp_page_id;
                 $pages->{$component_id}->title = $data['title'];
                 $stem = array();
                 $stem[] = $data['slug'];
                 $parent = $data['parent'];
                 // If the page is not attached to the root node, traverse the page tree backwards to the
                 // root node generating the reverse walk, then flip it and implode it to a string.
                 while ($parent != 0) {
                     $stem[] = $flat_pages[$parent]['slug'];
                     $parent = $flat_pages[$parent]['parent'];
                 }
                 // NOTE: BuddyPress incorrectly calls this a "slug", which is confusing. The correct term
                 // is a "stem" (in string form) and a "walk" (in array form).
                 $pages->{$component_id}->slug = implode('/', array_reverse((array) $stem));
             }
             unset($slug);
         }
         unset($wp_page_id, $data);
     }
     unset($component_id, $bp_page_id);
     return apply_filters('bp_core_get_directory_pages', $pages);
 }
开发者ID:alexborisov,项目名称:foxfire,代码行数:47,代码来源:class.router.php


示例16: add_steps

 function add_steps()
 {
     global $wp_rewrite;
     // Setup wizard steps
     $steps = array();
     if ('install' == $this->setup_type) {
         $steps = array(__('Components', 'buddypress'), __('Pages', 'buddypress'), __('Permalinks', 'buddypress'), __('Theme', 'buddypress'), __('Finish', 'buddypress'));
         // Update wizard steps
     } else {
         if ($this->is_network_activate) {
             $steps[] = __('Multisite Update', 'buddypress');
         }
         if ($this->db_version_raw < (int) $this->db_version) {
             $steps[] = __('Database Update', 'buddypress');
         }
         // New for BP 1.5
         if ($this->db_version_raw < 1801 || !bp_core_get_directory_page_ids()) {
             $steps[] = __('Components', 'buddypress');
             $steps[] = __('Pages', 'buddypress');
         }
         // New for BP 1.6
         if ($this->db_version_raw < 5222 && !defined('BP_USE_WP_ADMIN_BAR')) {
             $steps[] = __('Admin Bar', 'buddypress');
         }
         $steps[] = __('Finish', 'buddypress');
     }
     return $steps;
 }
开发者ID:newington,项目名称:buddypress,代码行数:28,代码来源:bp-core-update.php


示例17: register_post_types

 /**
  * registering post type
  */
 function register_post_types()
 {
     global $bp, $wpdb;
     if (empty($bp->pages->{$this->id}->slug)) {
         $directory_ids = bp_core_get_directory_page_ids();
         $page_id = $directory_ids[$this->id];
         $page_slug = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM {$wpdb->base_prefix}posts WHERE ID = %d AND post_status = 'publish' ", $page_id));
     } else {
         $page_slug = $bp->pages->{$this->id}->slug;
     }
     $slug = isset($page_slug) ? $page_slug : BP_CHECKINS_SLUG;
     // Set up some labels for the post type
     $labels = array('name' => __('Places', 'bp-checkins'), 'singular' => __('Place', 'bp-checkins'), 'menu_name' => __('Community Places', 'bp-checkins'), 'all_items' => __('All Places', 'bp-checkins'), 'singular_name' => __('Place', 'bp-checkins'), 'add_new' => __('Add New Place', 'bp-checkins'), 'add_new_item' => __('Add New Place', 'bp-checkins'), 'edit_item' => __('Edit Place', 'bp-checkins'), 'new_item' => __('New Place', 'bp-checkins'), 'view_item' => __('View Place', 'bp-checkins'), 'search_items' => __('Search Places', 'bp-checkins'), 'not_found' => __('No Places Found', 'bp-checkins'), 'not_found_in_trash' => __('No Places Found in Trash', 'bp-checkins'));
     $args = array('label' => __('Place', 'bp-checkins'), 'labels' => $labels, 'public' => false, 'rewrite' => array('slug' => $slug . '/place', 'with_front' => false), 'show_ui' => true, 'supports' => array('title', 'editor', 'author', 'excerpt', 'comments', 'custom-fields'), 'menu_icon' => BP_CHECKINS_PLUGIN_URL_IMG . '/community-places-post-type-icon.png', 'taxonomies' => array('places_category'));
     // Register the post type.
     register_post_type('places', $args);
     parent::register_post_types();
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:21,代码来源:bp-checkins-component.php


示例18: bp_core_admin_slugs_options

/**
 * Creates reusable markup for page setup on the Components and Pages dashboard panel.
 *
 * @package BuddyPress
 * @since 1.6.0
 * @todo Use settings API
 */
function bp_core_admin_slugs_options()
{
    $bp = buddypress();
    // Get the existing WP pages
    $existing_pages = bp_core_get_directory_page_ids();
    // Set up an array of components (along with component names) that have directory pages.
    $directory_pages = bp_core_admin_get_directory_pages();
    if (!empty($directory_pages)) {
        ?>

		<h3><?php 
        _e('Directories', 'buddypress');
        ?>
</h3>

		<p><?php 
        _e('Associate a WordPress Page with each BuddyPress component directory.', 'buddypress');
        ?>
</p>

		<table class="form-table">
			<tbody>

				<?php 
        foreach ($directory_pages as $name => $label) {
            ?>

					<tr valign="top">
						<th scope="row">
							<label for="bp_pages[<?php 
            echo esc_attr($name);
            ?>
]"><?php 
            echo esc_html($label);
            ?>
</label>
						</th>

						<td>

							<?php 
            if (!bp_is_root_blog()) {
                switch_to_blog(bp_get_root_blog_id());
            }
            ?>

							<?php 
            echo wp_dropdown_pages(array('name' => 'bp_pages[' . esc_attr($name) . ']', 'echo' => false, 'show_option_none' => __('- None -', 'buddypress'), 'selected' => !empty($existing_pages[$name]) ? $existing_pages[$name] : false));
            ?>

							<?php 
            if (!empty($existing_pages[$name])) {
                ?>

								<a href="<?php 
                echo get_permalink($existing_pages[$name]);
                ?>
" class="button-secondary" target="_bp"><?php 
                _e('View', 'buddypress');
                ?>
</a>

							<?php 
            }
            ?>

							<?php 
            if (!bp_is_root_blog()) {
                restore_current_blog();
            }
            ?>

						</td>
					</tr>


				<?php 
        }
        ?>

				<?php 
        /**
         * Fires after the display of default directories.
         *
         * Allows plugins to add their own directory associations.
         *
         * @since 1.5.0
         */
        do_action('bp_active_external_directories');
        ?>

			</tbody>
		</table>
//.........这里部分代码省略.........
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:101,代码来源:bp-core-admin-slugs.php


示例19: bp_core_activation_notice

/**
 * Verify that some BP prerequisites are set up properly, and notify the admin if not.
 *
 * On every Dashboard page, this function checks the following:
 *   - that pretty permalinks are enabled.
 *   - that every BP component that needs a WP page for a directory has one.
 *   - that no WP page has multiple BP components associated with it.
 * The administrator will be shown a notice for each check that fails.
 *
 * @global WPDB $wpdb WordPress DB object
 * @global WP_Rewrite $wp_rewrite
 *
 * @since 1.2.0
 */
function bp_core_activation_notice()
{
    global $wp_rewrite, $wpdb;
    // Only the super admin gets warnings.
    if (!bp_current_user_can('bp_moderate')) {
        return;
    }
    // Bail in user admin.
    if (is_user_admin()) {
        return;
    }
    // On multisite installs, don't load on a non-root blog, unless do_network_admin is overridden.
    if (is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog()) {
        return;
    }
    // Bail if in network admin, and BuddyPress is not network activated.
    if (is_network_admin() && !bp_is_network_activated()) {
        return;
    }
    /**
     * Check to make sure that the blog setup routine has run. This can't
     * happen during the wizard because of the order which the components
     * are loaded.
     */
    if (bp_is_active('blogs')) {
        $bp = buddypress();
        $count = $wpdb->get_var("SELECT COUNT(*) FROM {$bp->blogs->table_name}");
        if (empty($count)) {
            bp_blogs_record_existing_blogs();
        }
    }
    // Add notice if no rewrite rules are enabled.
    if (empty($wp_rewrite->permalink_structure)) {
        bp_core_add_admin_notice(sprintf(__('<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress'), admin_url('options-permalink.php')), 'error');
    }
    // Get BuddyPress instance.
    $bp = buddypress();
    /**
     * Check for orphaned BP components (BP component is enabled, no WP page exists).
     */
    $orphaned_components = array();
    $wp_page_components = array();
    // Only components with 'has_directory' require a WP page to function.
    foreach (array_keys($bp->loaded_components) as $component_id) {
        if (!empty($bp->{$component_id}->has_directory)) {
            $wp_page_components[] = array('id' => $component_id, 'name' => isset($bp->{$component_id}->name) ? $bp->{$component_id}->name : ucwords($bp->{$component_id}->id));
        }
    }
    // Activate and Register are special cases. They are not components but they need WP pages.
    // If user registration is disabled, we can skip this step.
    if (bp_get_signup_allowed()) {
        $wp_page_components[] = array('id' => 'activate', 'name' => __('Activate', 'buddypress'));
        $wp_page_components[] = array('id' => 'register', 'name' => __('Register', 'buddypress'));
    }
    // On the first admin screen after a new installation, this isn't set, so grab it to suppress
    // a misleading error message.
    if (empty($bp->pages->members)) {
        $bp->pages = bp_core_get_directory_pages();
    }
    foreach ($wp_page_components as $component) {
        if (!isset($bp->pages->{$component['id']})) {
            $orphaned_components[] = $component['name'];
        }
    }
    // Special case: If the Forums component is orphaned, but the bbPress 1.x installation is
    // not correctly set up, don't show a nag. (In these cases, it's probably the case that the
    // user is using bbPress 2.x; see https://buddypress.trac.wordpress.org/ticket/4292.
    if (isset($bp->forums->name) && in_array($bp->forums->name, $orphaned_components) && !bp_forums_is_installed_correctly()) {
        $forum_key = array_search($bp->forums->name, $orphaned_components);
        unset($orphaned_components[$forum_key]);
        $orphaned_components = array_values($orphaned_components);
    }
    if (!empty($orphaned_components)) {
        $admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
        $notice = sprintf(__('The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s">Repair</a>', 'buddypress'), esc_url($admin_url), '<strong>' . implode('</strong>, <strong>', $orphaned_components) . '</strong>');
        bp_core_add_admin_notice($notice);
    }
    // BP components cannot share a single WP page. Check for duplicate assignments, and post a message if found.
    $dupe_names = array();
    $page_ids = (array) bp_core_get_directory_page_ids();
    $dupes = array_diff_assoc($page_ids, array_unique($page_ids));
    if (!empty($dupes)) {
        foreach (array_keys($dupes) as $dupe_component) {
            $dupe_names[] = $bp->pages->{$dupe_component}->title;
        }
        // Make sure that there are no duplicate duplicates :).
//.........这里部分代码省略.........
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:101,代码来源:bp-core-admin-functions.php


示例20: bp_core_admin_slugs_options

/**
 * Creates reusable markup for page setup on the Components and Pages dashboard panel.
 *
 * @package BuddyPress
 * @since 1.6.0
 * @todo Use settings API
 */
function bp_core_admin_slugs_options()
{
    $bp = buddypress();
    // Get the existing WP pages
    $existing_pages = bp_core_get_directory_page_ids();
    // Set up an array of components (along with component names) that have directory pages.
    $directory_pages = bp_core_admin_get_directory_pages();
    if (!empty($directory_pages)) {
        ?>

		<h3><?php 
        _e('Directories', 'buddypress');
        ?>
</h3>

		<p><?php 
        _e('Associate a WordPress Page with each BuddyPress component directory.', 'buddypress');
        ?>
</p>

		<table class="form-table">
			<tbody>

				<?php 
        foreach ($directory_pages as $name => $label) {
            ?>

					<tr valign="top">
						<th scope="row">
							<label for="bp_pages[<?php 
            echo esc_attr($name);
            ?>
]"><?php 
            echo esc_html($label);
            ?>
</label>
						</th>

						<td>

							<?php 
            if (!bp_is_root_blog()) {
                switch_to_blog(bp_get_root_blog_id());
            }
            ?>

							<?php 
            echo wp_dropdown_pages(array('name' => 'bp_pages[' . esc_attr($name) . ']', 'echo' => false, 'show_option_none' => __('- None -', 'buddypress'), 'selected' => !empty($existing_pages[$name]) ? $existing_pages[$name] : false));
            ?>

							<?php 
            if (!empty($existing_pages[$name])) {
                ?>

								<a href="<?php 
                echo get_permalink($existing_pages[$name]);
                ?>
" class="button-secondary" target="_bp"><?php 
                _e('View', 'buddypress');
                ?>
</a>

							<?php 
            }
            ?>

							<?php 
            if (!bp_is_root_blog()) {
                restore_current_blog();
            }
            ?>

						</td>
					</tr>


				<?php 
        }
        ?>

				<?php 
        /**
         * Fires after the display of default directories.
         *
         * Allows plugins to add their own directory associations.
         *
         * @since 1.5.0
         */
        do_action('bp_active_external_directories');
        ?>

			</tbody>
		</table>
//.........这里部分代码省略.........
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:101,代码来源:bp-core-admin-slugs.php



注:本文中的bp_core_get_directory_page_ids函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bp_core_get_directory_pages函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_core_get_core_userdata函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap