本文整理汇总了PHP中bp_core_update_directory_page_ids函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_update_directory_page_ids函数的具体用法?PHP bp_core_update_directory_page_ids怎么用?PHP bp_core_update_directory_page_ids使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_update_directory_page_ids函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_core_admin_slugs_setup_handler
/**
* Handle saving of the BuddyPress slugs.
*
* @since 1.6.0
* @todo Use settings API
*/
function bp_core_admin_slugs_setup_handler()
{
if (isset($_POST['bp-admin-pages-submit'])) {
if (!check_admin_referer('bp-admin-pages-setup')) {
return false;
}
// Then, update the directory pages
if (isset($_POST['bp_pages'])) {
$directory_pages = array();
foreach ((array) $_POST['bp_pages'] as $key => $value) {
if (!empty($value)) {
$directory_pages[$key] = (int) $value;
}
}
bp_core_update_directory_page_ids($directory_pages);
}
$base_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings', 'updated' => 'true'), 'admin.php'));
wp_redirect($base_url);
}
}
示例2: bp_core_create_root_component_page
/**
* Create WordPress pages to be used as BP component directories.
*/
function bp_core_create_root_component_page()
{
// Get BuddyPress
$bp = buddypress();
$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('all'));
bp_core_update_directory_page_ids($page_ids);
}
示例3: test_inactive_components_should_be_removed_if_status_is_unspecified
/**
* @ticket BP6280
*/
public function test_inactive_components_should_be_removed_if_status_is_unspecified()
{
$old_page_ids = bp_core_get_directory_page_ids('all');
$page_ids = $old_page_ids;
$page_ids['foo'] = 12345;
bp_core_update_directory_page_ids($page_ids);
$found = bp_core_get_directory_page_ids('active');
$this->assertFalse(isset($found['foo']));
}
示例4: buddypress
/**
* @group BP6244
* @group bp_core_admin_get_active_components_from_submitted_settings
*/
public function test_bp_core_admin_get_active_components_from_submitted_settings_should_keep_custom_component_directory_page()
{
$bp = buddypress();
$reset_active_components = $bp->active_components;
// Create and activate the foo component
$bp->foo = new BP_Component();
$bp->foo->id = 'foo';
$bp->foo->slug = 'foo';
$bp->foo->name = 'Foo';
$bp->active_components[$bp->foo->id] = 1;
$new_page_ids = array($bp->foo->id => $this->factory->post->create(array('post_type' => 'page', 'post_title' => $bp->foo->name, 'post_name' => $bp->foo->slug)));
$page_ids = array_merge($new_page_ids, (array) bp_core_get_directory_page_ids('all'));
bp_core_update_directory_page_ids($page_ids);
$bp->active_components = bp_core_admin_get_active_components_from_submitted_settings($reset_active_components);
bp_core_add_page_mappings($bp->active_components);
$this->assertContains($bp->foo->id, array_keys(bp_core_get_directory_page_ids('all')));
// Reset buddypress() vars
$bp->active_components = $reset_active_components;
}
示例5: 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');
}